traversing

jQuery: find the next element that is not immediate?

Hello, I want to find the first span element after class counter, in code something like this: <div class="counter"></div> <p></p> <span></span> It seems like the next() function only finds the immediate next element, so something like this: $(".counter").next("span") Won't work. The way I have been using is a bit lengthy and I wa...

selecting nth div (and beyond) in jQuery

Say I have a div containing an unlimited number of child divs. Is there an easy way to get jQuery to select the nth div and every div after it so I can change those (in this case, call remove() on old divs)? ...

jquery - How to select all content between two tags

I have a document with headings and unordered lists. How can I use JQuery to select a given heading (by its unique class name) AND all content between that heading and the next heading? ...

jQuery and closure.

I have a multiple menu's on my page which all use the same mouseover and click events, so I decided to get it into a function. However vars seem to always be assigned to the last of the arguments for the hover(function, function) function. $(document).ready( function() { menuMouseOver = function() { for(i=0, u=arguments.length; i<u;...

jQuery - suggestions for a "nextWhile" traversion?

jQuery currently has .next(filter) and .nextAll(filter) but I need something that fits in the middle of these - effectively, a .nextWhile(filter) that repeatedly does next until the filter is no longer true, then stops (rather than continuing to the end). To demonstrate this, the following is some simplified HTML - (in reality, it is dy...

xPath Traversing

I am trying to use xPath to traverse through the code of a newspaper (for the sake of practice) right now I'd like to get the main article, it's picture and the small description I get of it. But I'm not that skilled in xPath so far and I can't get to the small description. withing this code: <div class="margenesPortlet"> <div class="...

jQuery: Find the element before and after a specific element

I have a list with links I use with tabs. It looks like this: <ul> <li><a href="#">First tab</a></li> <li><a href="#">Second tab</a></li> <li class="active"><a href="#">Active tab</a></li> <li><a href="#">Fourth tab</a></li> <li><a href="#">Fifth tab</a></li> </ul> How can I find the list element before and after t...

jquery next siblings

Hi stackoverflow! (first post!) Ive been trying to get this problem solved, but I cant seem to figure it out without some serious workarounds. if I have the following html code: <ul> <li class="parent"> headertext </li> <li> text </li> <li> text </li> <li> text </li> <li class="parent"> headertext </li> <li> text </li> <li> text </li>...

jQuery XML Parsing/Traversing

Hello guys, I have the following XML- <rows> <row id="5"> <cell>Item1</cell> <attrs> <attr> <id>1</id> <type>CheckBox</type> <values> <value> <id>10</id> </value> <value> <id>11</id> </value> </values> </attr> <attr> <id>2</id> ...

How can I traverse a directory tree using a bash or Perl script?

I am interested into getting into bash scripting and would like to know how you can traverse a unix directory and log the path to the file you are currently looking at if it matches a regex criteria. It would go like this: Traverse a large unix directory path file/folder structure. If the current file's contents contained a string tha...

Way(s) to extract selected node values from this XML Markup

Given the (specimen - real markup may be considerably more complicated) markup and constraints listed below, could anyone propose a solution (C#) more effective/efficient than walking the whole tree to retrieve { "@@value1@@", "@@value2@@", "@@value3@@" }, i.e. a list of tokens that are going to be replaced when the markup is actually us...

traversing classes using Jquery

Hi, I'm brand new at working with Jquery, this is actually my first real project with it, and I'm having a little bit of trouble. Here is my HTML: Edit: alright, I fleshed out the code, and included where the function is being called. <tr><th scope="row"><?php echo $box_name[$i] ?></th> <td> <div class="parent_div"> <d...

jQuery: Getting the two last list items?

I want to apply a special class to the two last list items in an unordered list with jQuery. Like this: <ul> <li>Lorem</li> <li>ipsum</li> <li>dolor</li> <li class="special">sit</li> <li class="special">amet</li> </ul> How to? Should I use :eq somehow? Thanks in advance Pontus ...

jQuery: get immediate next element after the current element

Hi i need set focus to the element that is immediate next(and in other case immediate prev ) to the current element eg <li>item1</li> <- prev element (get this element) <li>item1</li><- current element <li>item1</li> <- next element (get this element) <li>item1</li> this is what i used var curr = (event.target).next()...

Traversing list elements with jquery

Hi folks, I'm building a micro site at the moment and I have a problem. I want to scroll to the different list elements by clicking on my menu. This is working fine. But the problem is, by using the list index to traverse to the second or third element of mainmenu, its only working fine in the first menu because the index of the second...

tree traverse recursive in level-first order and depth-first order

Hello, Is there any algorithm can traverse a tree recursively in level-first order and non-recursively in postorder.Thanks a lot. ...

jquery traversing - there has to be a better way than mine!

Hi Folks, I'd like to know if someone has a better way to access the elements #type and #type_new based on my html: <tr> <th>Type of Organization</th> <td id="toggle"> <select name="type" id="type"> <option>Church</option> <option>College</option> <option>Theatre</option> </select> <input name="type_n...

jquery traversing

when i click on a link i take it's href value in a variable (the number represents an unique id), then...i have a separate ul: <ul class="class_one"> <li class="class_two"><a href="2345">some text</a></li> <li class="class_three"><a href="6789">some text</a></li> </ul> what i'm trying to do is to see if i have any "a" in my "ul"...

Most succint way to refer to a newly created object in jQuery?

I have a function called on the click of a link within a TD. Upon clicking, I traverse back up the DOM to the TR that the link was within, then create a new TR after it. So far so good. Now that I've created that new TR, with a TD within, what's the best to now refer to that newly created TD. Or, do I need to traverse my way back into ...

jquery bind event

html: <ul> <li><input type="submit" id="myId" value="someVal"/> </ul> jQuery $('ul').find('input[type="submit"]').click(function{ alert('nasty alert') $(this).attr('id','newId'); }); $('input#newId').click(function(){ $(this).hide(); }); ok, so my intention is to change the id after one click and th...