A key part of creating a plugin is – what information can we get back from the plugin? Sometimes we can't get information out, but that may just be a limitation of what we're trying to achieve with the plugin. In our case, we should be able to get the content out. Let's take a look at how we can achieve this with our quicktip plugin.
Before delving into the code, we'll take a look at what we're creating:
We need to start somewhere, and so there is no better place than the markup. In a copy of
tooltipv2.html
, go ahead and add the following highlighted code before closing the<div>
tag:<input type="submit" id="getValue" value="Get text from first tooltip" /> <div id="dialog" title="Basic dialog"> </div>
In a copy of
tooltipv2.js
, we need to expose thedata-
tags that we're implementing in the markup. Go ahead and add the configuration option fortiptag
, as indicated next:$(document).ready(function() { $('#img-list li a.tooltips...