jquery-selectors

Problem using jQuery clone function in form

Those snippes of code that you will check works fine for FF, Chrome, Safari, but seems to be a problem with IE when running jQuery clone function: My template: <form method="post" action="/post/add/"> {{ form.management_form }} <div class='table'> <table class='no_error'> <input id="id_mypost_set-0-title" type="text" ...

jQuery Add/Remove form fields plugin

I am looking for a good plugin to add/remove a set of form fields in a page. Like this one http://vipullimbachiya.com/jQuery/Plugins/MultiField/SampleMultiField.htm#example . This plugin can do what I want but am trying to find out if there is any better option available. I have seen one excellent plugin some time back but lost the u...

traversing td/tr with jquery's closest()

<td width="162"><span class="required">*</span> Name:</td> <td width="407"> <label> <input id="store_name" class="text_field alnum" type="text" minlength="3" maxlength="30" size="40" name="store_name" style="color: rgb(51, 51, 51);"/> </label> </td> <td class="char_count_area" style="color: green;"/> I have some...

Jquery tranversing DOM to find consecutives values

Thanks for looking, all helpful answers are voted up. This is my markup. I'm trying to find 2 consecutive divs cmk1 and cmk2 with the content RIGHT and HERE in consecutive order. div id 1 shouldn't match because there's a right but not here. div id 3 shouldn't match because there's a here but no right. I'm trying to find something t...

Is jquery ":contains" selector accepts this kind of value "Banking and Finance"?

Hello guys, I'm having problem with the contains in jquery. It seems that it only accepts one word. Not a phrase or two words. Example: $('#div:contains('Word')'); --> This is okay $('#div:contains('Just another word')'); --> This will return empty/this will not match. Have you experience this kind of problem? Your reply is greatl...

jQuery basic help

I'm sure I'm going to lose some rep points for this, because it's such a basic question, but I can't figure out what I'm doing wrong with jQuery selectors using "#" to select by id. given this element in my document: <%= Html.CheckBox("IsAlwaysValid", true, new { onchange = "showHideValidSetList()", id = "IsAlway...

Cannot select grid element through jQuery

This is a follow-up question to ASP.NET How to pass container value as javascript argument Darin Dimitrov has kindly provided his answer using jQuery, But for some reason, I was not able to select the grid row I wanted to. Here is the jQuery used to select row. $(function() { $('#_TrustGrid input[name^=trustDocIDTextBox]').each(f...

What is Join() in jQuery?

What is Join() in jquery? for example: var newText = $("p").text().split(" ").join("</span> <span>"); ...

jQuery: Selecting elements that don't have a specific descendant element

How would I select all table elements that do not have any descendant td elements using jQuery 1.3.2? ...

jQuery - making a clicked link underlined

Hello, just starting to get my hands dirty with the jQuery goodness and the first task i'm trying to tackle is to underline a link after it has been clicked. Naturally, after a different link in the same div was clicked the previous one is no longer underlined... Regards ...

How do I further filter a jquery element array while not running the jquery search again?

Given the following code, how do I use the variable divs created by the first jQuery selector, without rerunning it on the line where I add the class? So, given this: var divs = $("div.searchhit"); // more code here using divs.length divs.removeClass("selected"); $("div.searchhit:eq(0)").addClass("selected"); How do I get th...

Why is my jQuery code failing to match elements with dynamic ids?

This code is supposed to add a class attribute to the span element "saved" with the right id. but somewhat its not doing so. Perhaps something I am missing, cant seem to figure it out. <script type="text/javascript"> jQuery(function($){ $("a[id^='savebook-']").click(function(){ match = this.id.match(/savebook-(\d+)/); saved...

jQuery :not() with multiple class on a table row

Hi folks, So basically I use jQuery for alternating row colours by selecting all the tr tags associated with the table to be coloured and then subsequently colouring them accordingly. There are certain times where I do not want a certain tr to be coloured, however, and in those cases the alternating colourization should skip over those ...

Which filters can you use in Jquery.live selectors?

Is there a list of which filters can be used in selectors for the live method? I had a case where I needed to bind an event to all the tr's in a table body excluding the first. Broken Live Example: $('#ExampleTable tbody tr:not(:first)').live("dblclick", RowEvent); This would select the correct rows but the live event would bleed ov...

Replace a specific string on an HTML page using JQuery

We are supplying a blob of HTML content to be imported and displayed on someone else's page. The owners of the page put a title around our content blob, but the title is the name of our web service that provides the content, rather than a user-friendly name that we want to display to users. They can't figure out how to change the title o...

Quickest way to find an element with jQuery

Given the following html: <tr> <td>Content</td> <td>Content</td> <td>Content</td> <td><img id="imgProductPurchased" runat="server" visible="true" alt="Product Purchased" title="Product Purchased" src="/sitecore/shell/Themes/Standard/Applications/16x16/checkbox.png" /></td> <td> <asp:PlaceHolder ID="plhPurchased" runat="serv...

selecting root element in jquery

I need to be able to select the root element without knowing the node types, class, id or hierachy. <div id="0"> <div id="0a"> <div id="a01"></div> </div> <div id="0b"> </div> <div id="0c"> </div> </div> I want to be able to do something like $(':root') and have 0 selected in the example above. Better ...

Find and addClass

HTML: <table> <tr> <th>text</th> </tr> <tr> <td>text</td> </tr> </table> I want to do this: if found 'th' in 'first tr', addclass 'abc' to 'second tr'. Is this jQuery correct: $('table tr:eq(0)').find('th').next('tr').addClass("abc"); ...

jQuery selector samba

This is my first post on stackoverflow, hello everyone! My first venture into jQuery animation is to have a set of images in two divs, top-half and bottom-half, and make them rotate through with a flip-down transition a-la the ancient alarm clocks with flip-down numbers. I've got the animation down, but the problem is having more than...

Find dynamic classname of element with jQuery

Hey. I'm having a unknown number of elements like so: <div class="item item-1"></div> <div class="item item-2"></div> <div class="item item-3"></div> What I want to do, is check if each item has a classname starting with "item-". If true, then extract the id. Something like this: $("container").each(function if ($(this).hasClass...