jquery-selectors

Copying values of one table to another (how to convert this js function to jQuery)

半城伤御伤魂 提交于 2019-12-13 19:41:08
问题 I am stuck with a small problem here.. What i am trying to do is copy description of id's from one table to another. I have writter half of the javascript and can anybody tell me how to convert this function in jquery. I want the description copied from the first table based on the id to the second table. Have done this in jquery using 'contains', (Comparing 2 tables column values and copying the next column content to the second table) since there are 1000 table rows, the explorer crashes.

jquery selector needed to select all certain children of parent

久未见 提交于 2019-12-13 18:45:04
问题 I have a page with some tables on it. In each table the first row is normal but the rest of the rows have a class of hidden so that they are not displayed on load. In one of the cells on the first row of the table there is a link to click to view more details (fade in the hidden rows of that table). I'm struggling to get this to work though. So basically I need a selector that will find all the hidden rows that are in the same table as the element that's clicked so that they can be faded in.

call AS function from javascript/jquery

无人久伴 提交于 2019-12-13 18:25:24
问题 Using jquery,JS can we call a function in flex code.Below is that i have a button which calls a AS code.Can this be done if so how ? <script> function callas() { addBody();//call flex function } </script> <input type="button" onclick="callas();" /> FLEX code <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.controls.Button; import mx.controls.Alert; import flash.display.InteractiveObject; import

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

旧巷老猫 提交于 2019-12-13 17:26:55
问题 How would I select all table elements that do not have any descendant td elements using jQuery 1.3.2? 回答1: You could try: $("table:not(:has(tbody > tr > td))").doStuff(); Working example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { $("table:not(

When I click the next page in datatables my jquery selectors aren't working anymore

夙愿已清 提交于 2019-12-13 15:05:46
问题 I'm using datatables plugin for jquery to show my data on the page. I have this selector when someone clicks on a row: $('#myTable tr[class !="tableHeader"]').click(function(){ alert("clicked!"); } and everything is OK until I click on the "Next page" which shows me next 10 results - then this click function doesn't show "clicked" message box anymore no matter which row I click. I'm guessing that the problem is in a way how these new results (rows in the table) are shown, so please give me

Custom jQuery Pseudo-selector Receiving Undefined Arguments

五迷三道 提交于 2019-12-13 14:28:09
问题 I'm attempting to add a custom pseudo-selector to jQuery, currently using v1.8.0, based on a few different tutorials I've found. I'm essentially trying to implement a case insensitive :contains selector. My current incarnation looks like this $.expr[':'].icontains = function(obj, index, meta, stack){ return (obj.textContent || obj.innerText || jQuery(obj).text() || '').toLowerCase().indexOf(meta[3].toLowerCase()) >= 0; }; which came from this post. It seems like the selector is getting

jquery selector performance

放肆的年华 提交于 2019-12-13 14:19:16
问题 Is there a more performant way to write this. $('#test').find('option:selected[value!=""]') 回答1: You can tweak it at little, but using methods instead of Sizzle: $('#test').find('option').filter(function() { return this.selected && this.value.length }); Benchmark : http://jsperf.com/sizzle-vs-methods-filter/12 .filter() is about 70% faster for me. 回答2: Well, there will always only be one selected, so you don't need a find() handler in my opinion. I'll just write it like this: $('#test option

jQuery: How to find elements *without* a certain class

对着背影说爱祢 提交于 2019-12-13 13:08:04
问题 Why does this fail... $( 'div.contactAperson input' ).not( 'input.hadFocus' ).focus(function() { $(this).attr('value', '' ); }); ...it's meant to sniff out input's that have not got the class .hadFocus and then when one of that subset receives focus it should zap the value to null. Right now, input values are always getting zapped -- the test .not( 'input.hadFocus' ) is failing to stop execution. Btw, preceding the above code is the following code, which is working fine: $( 'div

Cannot use query selector with id's that includes “.” [duplicate]

佐手、 提交于 2019-12-13 10:33:39
问题 This question already has answers here : How to select html nodes by ID with jquery when the id contains a dot? (8 answers) Closed 2 years ago . Assume that I have a <li id="gen__1002_____46.14_li"> I want to select this li . To be able to achieve it, I wrote, var id="gen__1002_____46.14_li"; document.querySelector("#" + id); But querySelector returns as; Failed to execute 'querySelector' on 'Element': '#gen__1002_____46.14' is not a valid selector. When id does not include dot character, it

Help with manipulating child/parent elements with jQuery

风流意气都作罢 提交于 2019-12-13 07:15:54
问题 Currently I have this JQuery script var img = $(this); img.wrap('<div class="photo"></div>'); img.parent().append("<p>" + img.attr("alt") + "</p>"); which successfully turns the following: <img src="photo.jpg" alt="caption"> into this <div class="photo"> <img src="photos.jpg" alt="caption"/> <p>caption</p> </div> All is well unless the image has a link as a parent; <a href="#"><img since I want it to be correct html (I'm fussy) improving the resulting outcome bellow would be satisfactory <a