traversing

jQuery find parent form

i have this html <ul> <li><form action="#" name="formName"></li> <li><input type="text" name="someName" /></li> <li><input type="text" name="someOtherName" /></li> <li><input type="submit" name="submitButton" value="send"></li> <li></form></li> </ul> How can i select the form that the input[name="submitButton"] is ...

c++: pass function as parameter to another function

i am currently implementing a binary tree in c++ and i want to traverse it with a function called in_order(). is there any way to pass a function as an argument, so that i can do things like below (without having to write the code to traverse the list more than once)? struct tree_node; // and so on class tree; // and so on void ...

jquery select unique item

I am having issues with selecting a certain element in my html When I click on the link with class "event_rsvp", I want to effect the HTML of the span in the next li with the class of "interested-status" I have tried closest, tried going out to the parents, how do I tell one to talk to the other. <li rel="101590"><span class="rsvp-stat...

algorithm to traverse 3D coordinates without revisiting

Say we have a set of 3D (integer) coordinates from (0,0,0) to (100,100,100) We want to visit each possible coordinate (100^3 possible coordinates to visit) without visiting each coordinate more than once. The sum of the differences between each coordinate in adjacent steps cannot be more than 2 (I don't know if this is possible. If not,...

F# :: traversing lists There and Back Again

This is homework :-) Write a function that counts the number of elements in the list that are larger than or equal to the average (using integer division for simplicity). Using just a single traversal of the list structure! I already have a solution to this, BUT it involves ref variable changed from closure foo'. I'm interested in a...

jquery find next element with class

I'm having a brain fart here...I'm trying to find the next element with a class of "error" and hitting a wall. In looking at the demo on jQuery's site, this should work, but doesn't. $("button[disabled]").next().text("this button is disabled"); <div><button disabled="disabled">First</button> - <span>no overwrite</span><span class="...

Anything similar to E4X to find in/traverse JSON?

When for example returning JSON from a Google Spreadsheet, the object returned contains an array of entry objects (corresponding to rows in the spreadsheet). An entry can have a name like so: jsonObject.feed.entries[15].name = "xyz"; Can I easily return an entry with the name of "xyz" using shorhand notation (E4X) of some sort? thanks...

Traversing FTP listing

I am trying to to get all directories' name from an FTP server and store them in hierarchical order in a multidimensional list or dict So for example, a server that contains the following structure: /www/ mysite.com images png jpg at the end of the script, would give me a list such as ['/www/' [...

jQuery: How to get the closest value when a button is clicked?

I can't seem to get this code to work. How do I get the closest value of .abc when the button is clicked? Defining Closest ie: if you click the button where "A:" is at I want a value of 10. if you click the button listed in "B:" I want the value of 20. Here is the code: <script type="text/javascript"> $(function(){ $('.test').click...

jquery traversing problem, insert text

I have a quite easy jquery question that I can't get right, when clicking on a link I need to insert some text in the right p (the table row before). This is the html: <table> <tr> <td> <p class='MyClass'>NOT HERE</p> </td> </tr> <tr> <td> <p class='MyClass'>NOT HERE</p> </td> </tr> . . //Many table ro...

jQuery traversing question

For this HTML code: <table> <tr><td>Visible</td></tr> <tr><td>Visible</td></tr> <tr><td>Visible</td></tr> <!-- etc... --> <tr style="display:none"><td>Hidden</td></tr> <tr style="display:none"><td>Hidden</td></tr> <tr style="display:none"><td>Hidden</td></tr> <!-- etc... --> <tr><td><a class="show-5-m...

Disable all other TDs in a row if first TD is selected

I have a table that contains multiple rows. Each row contains 5 columns (or 5 TDs). Inside of the first TD is a text field and a select box. The 4 other TDs each contain a table that contains a set of radio buttons. <tr bgcolor=#ffffff> <td valign=center> <select name=player1> <option>0</option> <option>1</option> </select> ...

Jquery headache - live traversing

Hi guys, I am trying to accomplish to show a div that is in the same list element as the button that executes a javascript statement. The whole list is loaded by Ajax, so therefore is the live function used. However, i am quite stuck right now and have no idea of how to proceed. I have tried EQ, next, parent, children in several diffe...

xml parsing: tags should be in numerical array?

<?php /* Sample: $results = XMLParser::load('<xml ....'); $results = XMLParser::load(VSCHEMAS.'/Users.edit.xml'); */ /** * Abstract XMLParser class. A non-instantiable class that uses SimpleXML to parse XML, based on a path or body passed into the load method * * @abstract */ abstract class X...

Traverse a custom html string with Jquery

I am not able to traverse a custom html string with Jquery, like in this example: html = '<a href="http://www.site.com"&gt;&lt;img width="800" src="http://www.site.com/pic.jpg" alt="" /></a><br /><br />Description<br />'; found = $(html).find("a").length; "found" returns 0, while I would expect to get 1 I suspect I'm doing something ...

jQuery traversing to div above..

Hi there.. Having a few issues with JQuery traversal and looking for some asssistance.. If i have the following html <div id="1"> This is a div </div> <div id="2"> <a href="link">This is div 2</a> </div> What I would like to do, is when I click on the link in div 2, is add a class to div1 using dom traversal, and not just directly r...

jquery traversing and tables

This problem is making me a bit crazy. I have something like this <h3>Feeds <span><a class="smallbutton create_feed" href="javascript:;"> <strong>Create New</strong> </a> </span> <span class="div_form_add_feed"> <a class="smallbutton btn_save_feeds" href="javascript:;"> <strong> Add </strong></a> </span> ...

jQuery show/hide to cycle through tables

Hi, I need to set up jquery to cycle through tables, making sure it shows/hides the right one. The basic HTML structure is: <p><a href="#" class="month-next">Next Month</a></p> <table class="month-show"><tr><td>blurb</td></tr></table> <table class="month-hide"><tr><td>blurb</td></tr></table> <table class="month-hide"><tr><td>blurb</t...

Using jQuery to return next list item in a filtered list.

I have the following list <ul> <li id="item1">Item 1</li> <li id="item2">Item 2</li> <li>Item 3</li> <li id="item4">Item 4</li> </ul> Using jQuery, I'm trying to traverse the list of LIs whose IDs start with "item". var nextItemWithItemID = $("#item2").next("li[id^='item']); However, when I run this code, I end up retrievin...

Find class in table row

Hello. Take a look at this table: <table cellpadding="0" cellspacing="0" class="order_form"> <tr> <th>Amount</th> <th>Desc</th> <th>Price</th> <th>Total</th> </tr> <tr> <td><input type="text" class="order_count" /></td> <td> <span class="order_desc">Middagstallerk...