jquery-selectors

jQuery's selectors on string not working for Internet Explorer

Hi everyone, I make an ajax call with jQuery's "$.get" that returns a string to a function. This string contains both xml and html, and I have to extract some part of the html with jQuery's selectors, for example: $.get( url, function (xml) { $(xml).find('something').whatever(); } ); In that case, everything works...

Set selection box by Option Text

Hi! I have a Select-Box like this: <select id="mySelect"> <option value="1">Entry 1</option> <option value="2">Entry 2</option> <option value="3">Entry 3</option> <option value="4">Entry 4</option> <option value="5">Entry 5</option> </select> How can I set the val of my Select-Box by knowing only the text()-Attribu...

Jquery selector not working when element contains dot in tag name

Hi All, I have just started using jquery for the first time so i'm not sure if what i'm doing is correct. What i'm trying to do is very basic, I have a script which is adding a css watermark to textboxes upon load in an MVC view. To select the element i do the following: jQuery(document).ready(function(){$('#Department.DeptName').a...

JQuery selector selecting GridView paging

I've got the selector below: $("#<%=GridView1.ClientID%> td:nth-child(5)").hover('doSomething) Which is selecting the 5th td that is generated by a GridView. This is working fine. My problem is I have paging enabled, and its also selecting the < Prev 1 2 3 Next > at the bottom, any ideas how to exclude this? ...

jQuery selectors - how to select elements on multiple criteria including the type of their "next" element

Using jQuery I need to select elements that are: under the "menu" DIV only AND are DT elements AND are followed by a DD element In this sample HTML I would only want to select ids "select_me1" and "select_me2" <html><body> <div id="menu"> <dl> <dt id="dont_select1"><a href="#">don't 1</a></dt> </dl> ...

Internet Explorer 7 returns 'undefined' from jQuery class selector

I have a small JavaScript function that (among other things) retrieves the ID of the last element with a certain class name. var lastRowID = $(".sectionRow:last").attr('id'); It should find elements in a table that looks similar to the following: <table> <tr id="courseSection[0]" class="sectionRow"><td>stuff</td></tr> <tr id=...

How do I use these JSON results to build a dynamic html table in jQuery?

I have a textfield where the user enters some number and clicks the "search" button. On clicking the "Search" buttton it displays all the associated JSON records with that number. How do I construct the dynamic HTML table by looping through each record? Here is my JSON structure returned from PHP: [{"number":"ABC123-product1","value":"...

JQuery - finding a preceding character

I'm new to JQuery so this question might be an obvious one, but I have something that appends a text to what's already in an input box: $('a.blog_category').click(function(){ var current_value = $('#id_category').val(); $('#id_category').val(current_value + ', '+ this.text); return false }) I'd like to add an if clause that so...

jQuery selector "memory"

I have a form with multiple fields, and each time the user changes a field the form is submitted (via hidden iframe), and the response is placed within an appropriate div on the page via a callback. The first time this works fine. But on each subsequent field change and submission, the response is shown in every div that has been filled ...

Jquery change() function not working

I have two tables and I want to have change event on one table. That is when I click on first table, I want to have some changes to the second table. But somehow below change function is not working. Any suggestions? $("#history_table table:eq(0)").click(function(){ $("#history_table table:eq(1) thead tr th:nth-child...

With jQuery, how do I select an element with a meta-character in its name?

Let's say I have custom HTML tags like so: <fb:est hours="5">5 Hours</fb:est> <fb:act hours="4">4 Hours</fb:act> How do I select the fb:est elements? Doing var e = $('fb:est') does not work. And var e = $('fb\:est') doesn't work either. ...

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") ...

Access select using div/span id

In jquery is it possible to access a select element by simply using the div or span id plus the "select" selector? I ask because i have a series of auto-generated forms meaning I can't assign an id to the form elements plus the names are weird like "w24", I'd like to access a form element specifically a select using the surrounding span ...

jQuery selector equivalent to ~ but reverse

Hi, This does not seem to be in the docs of jQuery API, so it probably does not exist, but just wanted to get confirmation from fellow experts. Is there an equivalent to $('prev ~ next') but for previous siblings? (No methods, just selectors) ...

How to detect changes to a table using JQuery

I have a table which always updates by clicking on another link. This link has ajax functionality which is created by serverside API at run time and JQuery has no control over this link. Now whenever this link changes table, I want to call a function by JQuery, how do I do that? ...

How to do String Quotes in Jquery

How do i put the variables in this single quotes and double quotes iam confused var rdb ='<input type="radio" id="rdb_"'+ i +' data-value1='+ labelvalue[1] +' data-value2='+ data[i].value +'>'; t += '<tr><td>'+rdb+'</td><tr>'; Here variable "i" is dynamic , "labelvalue[1] " is dynamic and "data[i].value " is dynamic Due...

Help with jQuery selector

I have the following markup <div id="FirstDiv"> <div class="MyClass"> <span> <a href="#">link 1</a> <a href="#">link 2</a> </span> </div> </div> <div id="SecondDiv"> <div class="MyClass"> <span> <a href="#">link 1</a> <a href="#">link 2</a> </span> </div> </div>...

jQuery - select class not contained in another class

Possible Duplicate: jQuery filtering selector to remove nested elements matching pattern. I have a hierarchy of groups. Something like: <div class="group"> <span class="child"></span> <div class="group"> <span class="child"></span> <span class="child"></span> <span class="child"></span> </...

jQuery DOM node with additional selectors

I'm trying to do additional selections after I pass in a DOM node in jQuery. In this example, I'm trying to show a "hidden" submit button after a change in the select box (notice, I'm passing in the FORM element, NOT the SELECT element: <form id="UpdateRegistrationStatusForm"> <select id="registration_status" onchange="AdjustRegist...

Building a selector with literals and variables?

I have a variable whose value is the same as an ID on the page. When I do this: var foo = 'value'; $('#' + foo).thing(); it doesn't work. But this does work: var foo = 'value'; var bar = '#' + foo; //'#value'; $(bar).thing(); How can I build that selector in a single line? Creating extra single-use variables seems wasteful. ...