jquery-selectors

Attribute selector a[href=#example] no longer working after updating jQuery [duplicate]

拈花ヽ惹草 提交于 2019-12-24 09:47:50
问题 This question already has answers here : Why can't jQuery 3 identify the '#' character in an attribute selector? (2 answers) Closed 2 years ago . $('a[href=#InterventionEditDocs]').trigger('click'); This line of code was working for my project perfectly a few days back but after some updates or something it throws an error in the console. I fixed it by adding quotes around the value: $('a[href="#InterventionEditDocs"]').trigger('click'); and it is now working. But why was it working before,

How do I use jquery to select a sibling of the parent element?

旧巷老猫 提交于 2019-12-24 09:25:19
问题 I am trying to use jquery to specifically select a sibling a parent element that has the same . the code is like this: HTML <div class="cool-check-list"> <ul> <li> <label> <span class="icon"></span> <!-- trying to select this --> Awesome Label Name </label> <ul> <li> <label> <span class="icon"></span> <!-- clicking this toggles the class of the above icon class --> Awesome Label Name 2 </label> </li> </ul> </li> </ul> </div> JQUERY $('.icon', '.cool-check-list').click( function(e){ $(this)

Convert xPath to jQuery Selector

巧了我就是萌 提交于 2019-12-24 09:03:03
问题 How do I convert the following xPath into a jQuery 1.10 selector? /html/body/div[4]/div[2]/div/div/div/ul/li[4] I'd like to use the result to do something like this: jQuery('selector').hide(); 回答1: Well, it's a question of identifying the syntactical differences: XPath uses / as a parent/child delimiter, while CSS/jQuery selectors use > . XPath uses one-indexed square brackets to denote index, whereas jQuery uses the :nth-child() pseudo-selector So: var xpath = '/html/body/div[4]/div[2]/div

A way to chain selectors like this in jQuery? input:checked:not(:hidden)

[亡魂溺海] 提交于 2019-12-24 08:35:33
问题 I want to get all inputs that are checked and not hidden This doesn't work: .formyform input:checked:not(:hidden) Is there a simple way to do it? I couldn't find any example on the jQuery site 回答1: What you have should work, though you can simplify it with :visible: .formyform input:checked:visible You can test it out here. 来源: https://stackoverflow.com/questions/3835486/a-way-to-chain-selectors-like-this-in-jquery-inputcheckednothidden

Using jquery, what is the best way to get the “next” textbox with a specific class name

ε祈祈猫儿з 提交于 2019-12-24 08:27:09
问题 i have a bunch of repeating textboxes and comboboxes on an html page. I want to change the value of the textbox below the combobox when i change the combobox. So i have this code so far: $('.myDropdown').change(function () { var currentDropdownValue = $(this).val(); if (currentDropdownValue == "Regular") { //CHANGE TEXTBOX BELOW THIS COMBOBOX WITH CLASS = "QUANTITY" TO 10. } }); here is my html <select class="myDropdown"> <option value="volvo">Volvo</option> <option value="saab">Saab</option>

bxslider carousel code

核能气质少年 提交于 2019-12-24 07:54:56
问题 i am trying to implement the slider from this site http://bxslider.com/ i used the exact procedure what they said but still my code is not working can you guys tell me how to fix it i am providing my fiddle code blow http://jsfiddle.net/v3efb/3/ http://jsfiddle.net/v3efb/3/embedded/result/ providing my code below <ul class="bxslider"> <li><img src="http://maxcdn.webappers.com/img/2009/01/jquery-carousel.png" /></li> <li><img src="http://maxcdn.webappers.com/img/2009/01/jquery-carousel.png" />

Rebind dymanically created forms after jQuery ajax response

大憨熊 提交于 2019-12-24 07:45:07
问题 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 the .live() which seem to work great. Just the form dies. How do I rebind the dynamically created forms after the ajax call? They all have id of formname_id.

JQuery Sibling Selector not Appending Class because of CSS

无人久伴 提交于 2019-12-24 07:08:01
问题 I have a menu with sub-menu child navigation as well, and I'm trying to append a class to the parent of the children based on the hovering of the children's <ul> container. This is what I have so far: http://jsfiddle.net/2KhnX/15/ but as you can see, the class never gets appended. If I strip most of the CSS from the HTML, but leave the class I'd like appended, it works fine - http://jsfiddle.net/2KhnX/21/ Which leaves me to believe that the CSS is conflicting or ruining the event that the

Multiple Jquery dialogs on page using same classes

故事扮演 提交于 2019-12-24 06:34:54
问题 I have multiple places on my page where I want to open a jquery dialog boxes when a link is clicked. I am using class selectors so in theory I should be able to open each of them. My problem is that with the code I have it will only open the first dialog I click. Why is this??? //modal help div $('.dialogbox').dialog({ modal:true, autoOpen: false }); $(".modalhelp").click(function() { $('.dialogbox').dialog('open') }); The html: <a class="modalhelp" href="javascript:void[0]"><img src="images

Jquery - find links that have no target or a certain target

女生的网名这么多〃 提交于 2019-12-24 05:39:49
问题 I'd like to find all the links on a page that either have no target attribute or a target attribute that equals ' pageContent ' and for all matched elements I would like to apply an onclick event to them. The onclick event is called pgTrans('start') . I'm not sure if it matters but some of the links may already have this event hard coded or attached via jQuery. 回答1: Try the following: $('a:not([target]), a[target="pageContent"]').click(function(e) { e.preventDefault(); pgTrans('start'); });