Solved

need to create an iterator function in jQuery

Posted on 2011-09-29
3
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

691 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