Solved

need to create an iterator function in jQuery

Posted on 2011-09-29
3
193 Views
Last Modified: 2012-06-27
This works:

$( $( this ).siblings( "ul ") [0].innerHTML).show();

But I need to test each element mefore adding it to resulting the selector.

What syntax can I use to create a function?

Thanks.
0
Comment
Question by:newbieweb
3 Comments
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 250 total points
ID: 36851411
use http://api.jquery.com/each/
$( this ).siblings( "ul ") .each(function(){
  //here you can write custom code after check whatever you want to check
});
0
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 250 total points
ID: 36868483
$(this).find( "ul ") .each(function(){
 alert($(this).html());
});
0
 

Author Closing Comment

by:newbieweb
ID: 36895524
Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now