jquery-selectors

jQuery get next element after first match

Hello, I think my problem may be quite simple, but after trying different approaches I just don't get it. The UI that I want to implement basically looks like this: -Prev | Image 1 (Active) | Image 2 | Image 3 | Image n| Next- I want to allow user to change active image by pressing Next or Prev buttons. HTML for my UI looks like th...

Need help with a JQuery Selector that returns all checked checkboxes that are children of a node with a specified class.

Annoyingly enough, setting the cssClass property of an ASP.NET checkbox control renders HTML like so instead of just adding the class attribute to the input tag: <span class="myclass"> <input id="chkBox1" type="checkbox" name="chkBox1" /> </span> So here I am trying to write a Jquery filter that finds all of the checked checkboxe...

jQuery parent()

Hi Guys I need some help with parent() in jQuery. I have a list of images, each followed by a form, where the user can perform some actions, like changing the description of the image etc. <div id='items_list' class='items_list' > <div id='item_209' class='item_details' > <form action='actions_dispatch2.php' method='...

jquery not selecting option tags when value contains space

Do I need to somehow escape a space when using jquery to select with contains/find? I am mocking this up so pardon the typos... If I have a SELECT tag that has some options <select title="animals"> <option value="Dog Black">Dog Black</option> <option value="Cat Black">Cat Black</option> <option value="Dog Brown">Dog Brown</option> </se...

JQuery: Select elements that are before an anchor with a specific text

I have a div having a css class "MyClass". Inside this div, I can have any number of checkboxes immediately followed by an anchor having some specific text (lets say MyText for the example). How can I select all the checkbox elements using JQuery. What I have is $('div.givenclass input:checkbox')."I DON"T KNOW WHAT TO PUT HERE" I wan...

how to stop jQuery default accumulative loop

I've write a addrow event like this.... $('.addRow').click(function(){ var $newTr = $('#tb1 tbody>tr:last').clone(true); $newTr.insertAfter('#tb1 tbody>tr:last'); newRowNum += 1; $newTr.find('input[id^=foods]').attr('id', function(){ var newID = 'foods' + newRowNum ; $(this).attr('id',newID).attr('name',newID).attr('class',newID); });...

What's the difference between these two jQuery selectors?

With this markup: <div id="e"> <div id="f"></div> </div> Does $('#e > #f') return the same as $('#e #f')? ...

jQuery: Count Number of Inputs with a Specific Value

I need to count the number of text inputs with a value of 1. I have tried the following but with no luck. $('.class[value="1"]').length $('.class:contains("1")').length Using $('.class[value="1"]') technically works, however, if the values in the text input are changed after load, it still counts it as its default load value. I too...

jQuery: How to overwrite tables width?

I have the table that goes like this: <table style="width:375pt">. How can I overwrite its width to 50%? I need to select just this one table with this width and not other tables on the page. So the question is how to select the table with specific width? Thank you. ...

Add a unique ID to form input for total

Hi, The problem I'm having is i'm working on an invoicing system. Which uses this, $(document).ready(function() { $('#add').click(function() { JQuery('#lineItems').append('<input type="text" name="description[]" class="ui-corner-all text invDesc" /> <input type="text" name="qty[]" class="ui-corner-all ...

Object-Oriented jQuery Question...

$("#e1").click(function() { $("#descriptions div").removeClass("show"); $("#e1d").addClass("show"); }); $("#e2").click(function() { $("#descriptions div").removeClass("show"); $("#e2d").addClass("show"); }); <div id="descriptions"> <div id="e1"></div> <div id="e1d" class="description"></div> <div id="e2"></div> <div id="e2d"...

Every form element with its id starting with a tag

I got 2 forms in 2 different div's which are hidden, if the user clicks on one (login, register) the relevant div is shown. I've named the form fields like reg_username, reg_email ... and the login fields are named login_username login_password. Now i've created a function which validate the fields. When i step through with this part o...

How do I select more than one element using the jQuery attribute selector

I have two elements that I would like to select <input id="iMe" /> and <span id="sMe">Blah</span> I would like to select them both: $("span[id$='Me']") and $("input[id$='Me']") in one selector. I've tried: $("span,input[id$='Me']") -> Nope $("span[id$='Me'],input[id$='Me']") -> Nope $("span[id$='Me']input[id$='Me']") -> Nope I ...

help with onseek and selectors

I am using this: $(function() { // initialize scrollable window.api = $("div.scrollable").scrollable({ clickable: true, activeClass: "active", onSeek: function() { alert("current position is: " + this.getIndex()); //remove h...

jQuery select where attribute = value

I am trying to select an input where the value equals a dynamic value trimmed = jQuery.trim(a); preSelectedCheckBox = $(this).find("input[value=" + trimmed + "]"); The element exists but I constantly get no value returned. ($(preSelectedCheckBox).length = 0) ...

how to apply each index value of an array to each value of a group of selected elements

So if I have an array of 2 values and I want to apply those values to two elements, I can't seem to figure out a way to loop through the selected elements and have a counter or something to represent the index of the array value I want to apply. Anyone? For example: myTotal = new Array("7.00", "10.00"); <input class="theTotalInput"><...

How do I wrap everything inside a TD element with a SPAN or DIV

What am I doing wrong, my html is rendered as such: <td colspan="2"><input id="ctl00_ContentPlaceHolder1_Login1_RememberMe" type="checkbox" name="ctl00$ContentPlaceHolder1$Login1$RememberMe" /> <label for="ctl00_ContentPlaceHolder1_Login1_RememberMe">Remember me next time. </label></td> I want to wrap everything inside the TD ...

Can you do an 'AND' on a jQuery selector to target multiple buttons?

I have two types of buttons that I want to use the same code block. Rather than create two event handlers is it possible to reference the buttons by doing something like this: $(".lb",".da") I've tried the specific example and it doesn't work but hopefully it'll give you an idea for what I'm aiming at doing. TIA Lloyd ...

jQuery Selector not working right...

Okay, I cannot figure out what I'm doing wrong here... Take the following jQuery selector... $('tr[batchid]:has(span.chkselb input:checked) span[id=assetcount]') This returns 2 elements. Yet if I do the following selector: $('tr[batchid]:has(span.chkselb input:checked) span#assetcount') This returns 0 elements. Aren't these two...

"unknown pseudo-class or pseudo-element 'radio' "

There are many input radio elements on a web page and each radio element has several options. I want a function to be fired whenever one option of a radio element is checked. How to write the code using Jquery? One input element looks as follows: <div class="below"> <input type="radio" value="information" name="option0"/> information <i...