Skip to content

Widget: Document how to retrieve a widget's instance and how to tell whe... #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Widget: Give example of getting all elements that are instances of th…
…e widget.
  • Loading branch information
tjvantoll committed Feb 20, 2013
commit a8d50df106f117b722853a8f6ced099e56f67041
8 changes: 7 additions & 1 deletion entries/jQuery.widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

<h3>Instance</h3>

<p>The widget's instance is stored using jQuery core's <a href="http://api.jquery.com/jQuery.data/">data method</a> with the widget's full name as the key. Therefore, you can use the following to retrieve the progressbar widget's instance object from the element.</p>
<p>The widget's instance is stored using <a href="http://api.jquery.com/jQuery.data/"><code>jQuery.data()</code></a> with the widget's full name as the key. Therefore, you can use the following to retrieve the progressbar widget's instance object from the element.</p>

<pre><code>
$( "#elem" ).data( "ui-progressbar" );
Expand All @@ -99,6 +99,12 @@
$( "#elem" ).is( ":data( 'ui-progressbar' )" ); // true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea you could quote the name. You learn something new every day!

$( "#elem" ).is( ":data( 'ui-draggable' )" ); //false
</code></pre>

<p>You can also use <code>:data</code> to get a list of all elements that are instances of a given widget.</p>

<pre><code>
$( ":data( 'ui-progressbar' )" );
</code></pre>
</longdesc>
<category slug="utilities"/>
</entry>
Expand Down