jquery-traversing

Select the first element of a class 'x' after a link with jQuery

Hello, I've got some code like this: <p>Lorem ipsum<a href=# class="a">link</a><span class="b">Text</span>More lorem ipsum<a href=# class="a">link</a><span class="b">Text 2</span> And I'd like to let users click the link and be able to do something with the span (make it flash, hide it, whatever). I'm using jQuery, and this is what...

Select and disable each input field within a form, wrapped in a table in jquery

Hi, I am disabling a form based on a checkbox... I am having trouble adding the disabled attribute. here is what I got so far: HTML: <table id="shipInfoTable"> <tr> <td>Name:</td> <td><input type="text" name="name" /></td> </tr> ... </table> Javascript selector/attribute manipulation(jquery): $("#shipInfoTable tbody tr...

Navigating to a specific element with jQuery

I have a table, trying to figure out how to navigate to the 3.35 and add columns. Is there a way to specify which TD i want to navigate to with jQuery? Thanks ahead of time! <table> <tbody> <tr> <td> <table> <tbody> <tr> <td><a href="">title</a></td> <td><a href="">ra...

Get all Select Elements in a Form by referencing $(this) instead of $("form select")

Hi Guys I'm currently getting all the Select elements that exist in a form with the following: $("form").submit(function(event) { // gather data var data = GetSelectData($("form select")); // do submit $.post($(this).attr("action"), data, ..etc) }); Instead of passing in $("form select"), is there a way I can say som...

IN Jquery , how do I go up a parent node?

I just want to go up a parent node, so I can do a .find inside that parent node. In a sense, I want to .find a sister. ...

Traversing from Bookmark Hashtags (#bookmark) in jQuery?

I am having trouble traversing from a bookmark has tag in jquery. Specifically, the following HTML: <a id="comment-1"></a> <div class="comment"> <h2 class="title"><a href="#comment-1">1st Post</a></h2> <div class="content"> <p>this is 1st reply to the original post</p> </div> <div class="test">1st post second line</div> ...

jquery nextUntil has element

I have a bunch of elements like this: <div></div> <span></span> <table></table> <div></div> <span></span> <div></div> I need to check whether or not there's a table element in between the divs, and if so do something. $('div').each(function () { if ($(this).nextUntil('div').include('table')) { $(this).addClass('got-a-table'); ...

Is there a jQuery selector to accomplish this task?

I have these 4 HTML snippets: Siblings: <div class="a">...</div> <div class="b">...</div> <!--selected--> <div class="b">...</div> <!--not selected--> Wrapped 1: <div class="a">...</div> <div> <div class="b">...</div> <!--selected--> </div> <div class="b">...</div> <!--not selected--> Wrapped 2: <div> ...

jQuery - preceding node - no common parent node

Hi Using jQuery I would like to locate a preceding node from a given node. The preceding node and the given node may not have the same parent node! Please check the following fragment: <div class="container"> <div id="sec1"> <p>Some text</p> <p><b>Some</b> text<</p> <p>Some <b>more</b> text</p> </div> <div id="sec2"> <p...

Using Jquery to expand all answers below question

Hi there, I am trying to work out how to expand all answers below a question when an .allopener span is pressed. Users can currently expand each answer individually, but not all at once. Any tips would be much appreciated. There would be many items on a page. The allopener span button will open up the remaining unhidden .text classes in...

change html object inside cloned object

supose i have tr like this : <tr id="file" > <td width="510"><div align="right"><span class="star"> *</span> <input type="text" name="title" style="width:500px;direction:ltr" /> </div></td> <td width="156" nowrap="nowrap"><div align="right">file </div></td> </tr> and i ha...

How to access the element using "this"

Hi friends,I need to access a SPAN tag with in every DIV tag so i used this following code $("DIV").click(function(){ $(this + "SPAN").show(); }); Is the above code is correct? Its not working for me! Its showing nothing too.. Please help me Thanks,Praveen J ...

Jquery making real-time input checking

I am trying to write a script that validates user input. Like: letter length more than 5 or password and reentered-password match. But how can I get which input box in the form was clicked? I used $(function() { $('#register input').keyup(function() { if ($('#username').val().length < 5) { $('a.username').text("...

jquery set class for a children of particular type

I have callout label associated with multiple controls, which should turn red when either of it is wrong. <tr> <th> <asp:Label for="test">jquery will make my class as updnValidationErrorLabel</asp:Label> </th> <td > this text is right <asp:TextBox class='textboxWide taskListCheckPreVital' /> </td> <td...

Can I access a name of last used traversing operation in a chain?

I was wondering if it's possible to get to the name of the method that created a current array of elements. I tried to find it in the jquery object itself, but I don't see a place where it could be stored. Try to fill this in $.fn.myfunc=function(){ //your brilliant idea here return functname; } $('body').find('.a').myfunc(); //retur...

How can I check if two elements/div belong to the same parent?

Hi I am working on this piece of code for a shopping cart $('.addtoCart').click(function() { //get button id var cartID = $(this).attr("id"); //get check box id var checkBoxID = $('input.cartLevelChecked:checked').attr("id"); //get parent id var levelListID = $(this).closest('li').attr("id"); if...

jQuery chaining parent(), is there an easier way?

Hay, I have some markup like this <div id="some-id"> <h2><a href="#">Title</a></h2> </div> and some jQuery like this $(this).parent().parent().attr("id") $(this) is referring to the 'a' tag within the 'h2' Is there an easier way to select the parent div without using parent() twice. I tried $(this).parent("div").attr("id") ...

jquery selector issue

I have a div which in jquery's document ready I append - using $("#div id").append('html text') syntax - with 10 or so more div child elements. once this is done I try to check the content of the child divs via alert($(".classname")); and it comes back with: function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.te...

JQuery-equivalent to prototypes Down()-function

I'm porting a webapp from prototype to jquery in which I often used the prototype Down() function. (selecting the first child of a given element) Glancing over the JQuery-api one of the ways to do this would be: prototype: $('abc').down(); jquery: $('abc').children().first(); However, since this first fetches all children and ap...