jquery-selectors

jquery .attr('alt','logo').css('display','none') not working !!!

I have the three following lines and the first two line gets all the images on the document and hides all, but then when I add the third line shows all the images. What I need its to hide only the images with the attribute alt=minimize and alt=maximize but for some reason hides all the images. $('img').attr('alt', 'minimize').css("disp...

Answered: Selecting even table rows from a table element

The issue I am having is: How do I go from a variable pointing at a dom element to using CSS selectors? I want to make this work: function highlight(table) {$(table " > :even").toggleClass('highlight');} where table is a reference to a table element. I don't want answers that tell me to use $('#table') because that defeats the poin...

jQuery: How to hide all HTML elements which have a value greater than a certain value for a given tag

I display elements in a hierarchy, clicking one displays the next set of elements in the hirearchy. Each element has a tag called "level" which has some value which is 1-.... (whatever the number of levels is for that branch of the tree). When an element is clicked I want the next elements to be displayed, but if an element is clicked a...

Rebind dymanically created forms after jQuery ajax response

I'm kinda new to jQuery but understand it for the most part. My problem is that when my ajax call which refreshes the entire div is done, all my dynamically created forms don't work. If you try and submit them, the event doens't work properly and just tries to do a normal form submit. I have all the other items such as links bound using ...

jquery autocomplete filtering?

I want to filter the autocomplete results based on the selected option in a select input. sample json data: [{"ContactId":"8590051631","ContactType":Company,"Name":"Test },{""ContactId":"8590049225","ContactType":Person,"Name":"TestName}] here's my markup <div> <select class="type"> <option>Person</option> <option>Company</option> <...

jQuery: Selector confusion

What is wrong with this jQuery selector? $("#masterHeaderMenu.masterHeaderMenuButton a:first") I'm intending to select the first anchor tag that is a child of an element whose class is "masterHeaderMenuButton", itself a child of the element with an "id" attribute value of "masterHeaderMenu". Can't I do this in jQuery? ...

Jquery :not selector not working in ie

I have the following html code: <ul> <li class="O"> <label for="radio1">Radio 1:</label> <input type="radio" name="radio1" value="Yes" checked>Yes</input> <input type="radio" name="radio1" value="No">No</input> </li> <li class="O"...

how to get img src value

I have some contents inside div tag... within that div tag content I have to search for img src tag value based on that value i have to highlight some images and to show some div content for example if img src value contains "http://google.com/test/test.img" have to highlight and to show img is highlighted div content if img src va...

jquery parent/children selector for counting <li>

Hi. I have this piece of HTML <div id="fileTreeInviati"> <ul class="php-file-tree"> <li class="pft-directory"> <a href="#" class="" name="101">A006 - SOMETEXT (<span name="contaNew"></span>)</a> <img src="./moduli/home/images/info.png" title="Informazioni Azienda" class="imgInfo"/> <ul style="display: non...

jQuery show submit button on input field click

Hi, I'm trying to have a comment input field that will show the submit button on a dynamically created form when you click on the input field. Similar to how facebook comments work. When you click on the input field the submit button appears and when you click off it disappears. All the comment input id's are comment_1 etc and the subm...

How to refresh jQuery Selector Value after an execution?

Hi, I have like this. $(document).ready(function() { var $clickable_pieces = $('.chess_piece').parent(); $($clickable_pieces).addClass('selectee'); // add selectee class var $selectee = $('.chess_square.selectee'); // wait for click $($selectee).bind('click',function(){ $('.chess_square.selected').removeClass('selected'); $(...

JQuery create new select option

Hi I have the below functions in regular javascript creating select options. Is there a way I can do this with JQuery without having to use the form object? Perhaps storing the options as an array of json objects and parsing this in the calling function... function populate(form) { form.options.length = 0; form.options[0] = new Option(...

How to get the text of a div which is not a part of any other container in JQuery?

This should be real easy. Given below is the HTML. <div id='attachmentContainer'> #Attachment# <span id='spnAttachmentName' class='hidden'>#AttachmentName#</span> <span id='spnAttachmentPath' class='hidden'>#AttachmentPath#</span> </div> I want to get just the #Attachment# and not the other text. When I tried $("#attac...

jquery(selector) how to select the last element from two different classes

for the following html <div> <div class="col1" > I dont want to select this </div> <div class="col2"> I dont want to select this </div> <div class="col1"> I dont want to select this </div> <div class="col1"> I dont want to select this </div> <div class="col2"> ...

Select every other 2 table rows with jquery

I am currently using this code to add a class to every other row in my table. $(".stripeMe tr:even").addClass("alt"); However, on another table I'd like to add a class to rows 3,4, 7,8, 11,12 and so on... Is this possible? ...

jQuery onclick selector doesn't work

Hi, I have a selector: $("input[type='button'][onclick^='save']") and it works in FF but on IE... There is something wrong with onclick selector part. Is there a way to make cross-browser workaround? Thanks Pawel edit: $("img[src$='scroll.gif']").click(function(){ var targetOffset = $("input[type='button'][onclick^='save']...

How do you change the style of cell in a JQuery.DataTable?

Hello fellow coders, I have a question about setting the style attributes for a data cell in the jQuery.DataTable. I was able to set the width for each column when initializing the dataTable using the following: oTable = $('#example').dataTable( { "aoColumns" : [ { sWidth: '40%' }, { sWidth: '60%' } ] } ); ...

Is it possible to search through json result with jQuery

What I'm trying to achieve, is to output a json list that contains a list of Css classes, and their corresponding url records, i.e. var jsonList = [{"CSSClass":"testclass1","VideoUrl":"/Movies/movie.flv"},{"CSSClass":"testclass2","VideoUrl":"/Movies/movie2.flx"}]; //]]> foreach item in the list I am adding a click event to the class.....

use JQuery to get a list of classes

Hi I have a un-ordered (ul) html list. Each li item has 1 or more classes attached to it. I want to go through this ul list and get all the (distinct) classes. Then from this list create a list of checkboxes who's value matches that of the class and also who's label matches that of the class. One checkbox for each class. What is the b...

JQuery. Check value of select box and textbox with same class, Is it possible?

I have several select boxes and textboxes with the same class and I have the following statement. UPDATED //This goes through each visible tr of the table with class notEmptyTable $('.notEmptyTable tr:visible').each(function(index) { //This checks that the elements with class checkTextBox1IsNotEmpty its not Empty. if ($('.check...