FAQ Database Discussion Community


Finding the name of method in jquery

jquery,jquery-selectors
I am trying to find the method names in my html code. So I will find the method name in 'onclick' attribute and then make operations. This is current code: <div class="button" style="width: 60px; float: right;" onclick="closeModalDialog('dialogAttachmentModal');">BLABLA</div> I want to write jquery like this: $('closeModalDialog').attr('id','btnCloseModal'); And I want to show...

Strange behaviour with jQuery pseudo selector :visible

javascript,jquery,jquery-selectors
I have a query that looked like this: $("div.modal:visible select#DTE_Field_calculator\\.type") which would attempt, in theory, to find that <select> tag inside of the currently visible div.modal element. Unfortunately, it would return nothing at all, despite the DOM looking exactly as you would expect (<div class="modal">...<select id="DTE_Field_calculator.type">...) If I removed the...

JQuery: Select all ids ending with specific name and change its siblings input button

javascript,jquery,jquery-selectors
I'm trying to indicate that a text can't be sent just yet, showing a grey input submit button with the class btn-primary. Instead btn-default is a coloured input button. However there are many textareas on one single site as my JQuery code should be used for both posting a new...

Jquery: how do i apply Empty Text to all textboxes, not just 1

jquery,asp.net,jquery-selectors
I have this script which will put the tool tip text from a textbox as it's "Empty Text". Then when you click on it, the empty text disappears and reappears if you Blur and the textbox is still empty. var $textbox = $("#MainContent_tbCity"); // select single box (how get all?)...

How can multiple variables be used to create multiple jquery selectors?

javascript,jquery,variables,jquery-selectors,addclass
When I convert multiple variables into multiple selectors the below code fails to execute. DEMO HERE $('.Btn').on('click', function () { var outer = $(this).data('test'); var inner = $(outer).children('.Inner'); $(outer + ',' + inner).addClass('Success'); }); In the code above: This is successful $(outer).addClass('Success'); This is successful $(inner).addClass('Success'); This is not $(outer...

Is there any way to get the closest parent which have a specific class

jquery,jquery-selectors
In my application I have to get to the closest parents of the input/textarea which has the class of ('form-group'). I use the following code: $("#contactus").validate({ highlight: function (element, errorClass) { $(element).parent('.form-group').addClass('error-sign-up'); } }); For the cases of element which is input the code is fine (the direct parents of...

Why does jQuery's :contains count unexpected in my code?

javascript,jquery,jquery-selectors
I have a function that takes two parameters: The first is a string to count, the second the id of an HTML element in which the function is supposed to count occurrances of that string. function countString(searchString, elementToSearchIn) { return $("#"+elementToSearchIn+" *:contains("+searchString+")").length; // In this example, call will be $("#searchElement...

Select an element inside an element

javascript,jquery,jquery-selectors
Here is my DOM: <div class="a"> <div class="b">b</div> <div class="c">c</div> </div> JS: $('div.a').on('click',function(){ // ....add a div append to div.a }); $('div.b').on('click',function(){ //....edit the content of element }); Clicking div.a will add another div (d,e,f,etc.) inside div.a. Clicking div.b, div.c or other div inside will edit the content of div.b....

CSS or jQuery selctor? [closed]

jquery,html,css,jquery-selectors,css-selectors
Let's say there is the following HTML: <div id="test"> <span class="testSpan"></span> </div> There are two ways of selecting the span inside the #test div (I know I can select the span directly but this is not the point of the question): $('#test > .testSpan'); and $('#test').find('.testSpan'); Which of these ways...

jQuery :empty not working with input

javascript,jquery,jquery-selectors
I am having a problem in using jQuery's :empty pseudo selector. Basically, it isn't working on inputs the way I think it should. Given this html, I'm trying to get a count of all the inputs which don't have values without a loop. <div id="sampleDiv"> <label>My first Input:</label> <input name="test"...

Jquery: How to select a specific previous id dynamically?

jquery,jquery-selectors
I'm trying to add a comment box like you could open in Facebook when you click on "comment". So I want to select the most previous id containing "users_log_id" of the current "comment" link I'm clicking on. Note: After "users_log_id" is always the id of the current id like this:...

Remove empty

, but allow only one per group

javascript,jquery,jquery-selectors,is-empty
I was wondering how to remove empty elements, but allow only one empty element per group (next to non-empty one) ? Something like : Example HTML : <p>Hello world</p> <p><br></p> <p><br></p> <!--This will remove--> <p><br></p> <!--This will remove--> <p>Lorem ipsum dolor sit amet</p> <p><br></p> <p><br></p> <!--This will remove--> <p>Eum ne...

How do I select a class but not its inside element?

javascript,jquery,jquery-selectors,selector
Say I have <div id="mydiv"> <div class="myclass"> <span class="otherclass"></span> and many other classes... </div> </div> I want to capture the click event on .mydiv but not inside .myclass. I tried .mydiv:not(.myclass) but it doesn't seem to work. I think it's because I might be clicking on the otherclass so the...

Embedding a function inside .delay() doesn't work porperly

jquery,html,html5,css3,jquery-selectors
So I have HTML with a table and each column has button which should fade out that table and then fade in another DIV which contains info regarding about that specific column I clicked on. so the Jquery looks like this: $(document).ready(function(){ $('#motoBttn').bind('click', function(){ $('#ServicesContent').fadeOut(); $('#infoSlector').fadeIn(); $('#motoDescContent').fadeIn(); $('#goBackDiv').fadeIn() ; })...

Is there any meaning to 'first' pseudoclass?

jquery,jquery-selectors
I found this code: $("#some_list li a:first").click(); And I can't find any source about 'first' pseudoclass. Have anyone seen something like that ? Does it mean that first element on list is clicked ?...

JQuery how to select parent but not children

jquery,jquery-selectors
Sorry for what is probably an easy question, but I haven't found a way to make this work yet. I'm new to JQuery and I've got some nested lists which I'm trying to add a click event to a parent list which will slideToggle the children lists, which I've got...

Select word between two words

javascript,arrays,jquery-selectors
How can I create a function that selects everything between the words X and Y and pushes it to an array. By Greili - 4 Hours and 40 Minutes ago. #NsShinyGiveaway 0 comments By ToneBob - 4 Hours and 49 Minutes ago. #NsShinyGiveaway 0 comments By hela222 - 5 Hours...

Syntax error with jquery selecting table row with a specific attribute

javascript,jquery,jquery-selectors
I am trying to pull the data out from a table row so that it can be updated, but I am really confused as to why it is not happening. Below is a snippet of generated HTML. The record ID is held in the first data element as the value...

Union between two jquery selectors

jquery,jquery-selectors,selector
This is my case: var elems = form.find(':input'); var clEditors = form.find('.cleditor').parent(); elems.css('border', '2px'); clEditors.css('border', '2px'); Is there anyway I could prevent the duplication and do something like this: var elems = form.find(':input').union(form.find('.cleditor').parent()); elems.css('border', '2px'); I tried using a multi selector with the :parent selector and it didn't work: var...

Get just class names from string selector, jQuery way?

jquery,jquery-selectors
Suppose I have string selector such as: input.js-pretty-select[type="radio"].selected How can I get just all class names (js-pretty-select and selected) from this string, possibly using some jQuery core function? I thought about some regex at first, but then I realized that jQuery might have that already implemented somewhere in it's code,...

Can't select span inside div (jquery) [closed]

jquery,html,jquery-selectors
I can't seem to select the span inside the image below with the class 'star-rating-control. I'm trying to move it to one of the labels above (which I can select) Can anyone help? I've tried the following: var test = $("span.star-rating-control"); var test = $("div.write-review form#reviews span.star-rating-control"); If any other...

Find descendant elements that do not have a specific ancestor

jquery,jquery-selectors
I want to be able to select an element and find all descendant elements with a specific class but are not contained with a similar parent element. It's hard to describe: Html: <div class="js-test js-1"> <div class="b">1</div> <div class="b">1</div> <div class="d"> <div class="b">1</div> </div> <div class="js-test js-2"> <div class="b">2</div> <div...

Jquery onchange event not triggering

javascript,jquery,html,struts2,jquery-selectors
I am stuck in a situation where I have a Struts2 form with a select tag which when changed should trigger an event and I can't figure out why the onchange function is not triggering but the peculiar thing is that the onchange trigger event works in an other example....

Jquery.on('click') does not work on “class selector”

jquery,jquery-selectors
The following code http://jsfiddle.net/HCUYW/100/ does not emit click event. $(".todoitem").on('click', function() { alert('Item selectedd'); }); The workaround is to use the click method directly as $(".todoitem").click(...). How to make the .on('click',...) work on class selector ?...

jQuery selector based on not having class inside

javascript,jquery,jquery-selectors
I need to select an element based on what is not inside it's element. <div class="person"> <div class="name">Jason</div> </div> <div class="person"> </div> What do I need to do to select the second div with the person class. I know there are has and not properties, do I need to combine...

action on parent's sibling in jQuery

javascript,jquery,jquery-selectors
Here's my html code: <div class="btn-group js_publish_management> <button class="btn btn-danger js_publish_btn">Not Published</button> <button class="btn btn-success js_publish_btn">Published</button> <button type="button" t-attf-class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li> <a href="#" class="js_publish_btn"> <span...

Select all Children except first N - CSS Selector

jquery,css,jquery-selectors,css-selectors
<td> <p></p> <p></p> <p></p> <p></p> <p></p> <p></p> <p></p> </td> I want to get all ps except the first 3. I am doing it like so td p:not(:nth-child(1),:nth-child(2),:nth-child(3)) But what if I want all ps except first 20? Will I have to write manually like I did above?...

Passing multiple jQuery objects as an array

javascript,jquery,arrays,object,jquery-selectors
I'm wondering if it's possible to do something like this in jQuery: $( [ $selector1, $selector2, document.getElemetByID( 'test' ) ] ) EDIT: I'm lazy. $selector1 and $selector2 are already jQuery objects. I am trying to avoid using $.each. Here's a more in-depth example of what I'm trying to do: var...

Select the first-of-type div in a list that all have a data-attribute for the state it's associated with

css,jquery-selectors,css-selectors
I have a dynamically created list of elements that are job's in a particular state. There can be more then one job per state and I'm trying to select the first one of each state, but not just the first one in this huge list. For example: <section class="careers"> <div...

How to change the color of first option in select using jQuery

jquery,jquery-selectors
I am having the following Html <select> <option value>--Select--</option> <option value="60">Salaried Employee</option> <option value="61">Trainee</option> <option value="62">Skilled Worker</option> </select> Now here the my requirement is to display the first option in a blue color and the rest in black color. The first option should be blue in color either selected or...

jQuery/Javascript get classes of multiple elements to show an element with this class

javascript,jquery,class,if-statement,jquery-selectors
I'm struggling with a jQuery live search. First of all the live search update with the following code works. //live search function function live_search(list) { $("#search") .change( function () { //getting search value var searchtext = $(this).val(); if(searchtext) { //finding If content matches with searck keyword $matches = $(list).find('a:Contains(' +...

Force angular.element .on 'change' to call specified function on the same file

angularjs,events,jquery-selectors,document
When I select say hello.png the first time, it loads it and calls handleFileSelect() function. However, if I pick the same file again, the function won't get called until I pick another filename. How can I force it to call the function? I was thinking that the modification would be...

Apply CSS Style Up to the First Period in Every Element with a Certain Class

javascript,jquery,jquery-selectors,substring
I'm trying to apply CSS styles to all of the characters up to the first period in the text of every element with a certain class. My initial attempt was to select the first 2 characters only, but that won't work if there are sub-items ( for example: "D (i)."...

Using a jQuery Selector With a Variable

javascript,jquery,variables,jquery-selectors
Is there any way to make something like the following code? var input = ("$(\"#div .input[id='" + id + "']\")"); input.fadeIn(); Or maybe I could use something like the following? var input = ("\"#div .input[id='" + id + "']\""); $(input).fadeIn(); PS: Take my apologies as this question was cloned but...

How can I apply jquery selector to only visible checkboxes?

jquery,jquery-selectors,visibility
I have the following code that checks all checkboxes in a html table column $('.selectAll').on('click', function (e) { if ($(this).is(':checked')) { $('input[type=checkbox][value=' + $(this).attr("id") + ']').prop('checked', true); } else { $('input[type=checkbox][value=' + $(this).attr("id") + ']').prop('checked', false); } }); which works great except in certain cases some of the rows of...

Why jquery nth child give inconsistent result when apply to ul and li

jquery,jquery-selectors
I have a container with a group of uls, of each have 4 lis. I created the first ul then copy the rest by Javascript. When I call to find nth-child of all uls, eg $("ul:nth-child(1)"), it return nothing, the first ul item appear with $("ul:nth-child(2)") (n is starting from...

jquery selector: child elements of the same class inside divs of different classes

jquery,html,css,jquery-selectors
There are two divs with classes ".div1" and ".div2". Each of them contains the same code - the same elements with the same class names. If I need to set/get a value of an element inside one of the divs, how do I refer to those elements? I try the...

How to select a single cloned element?

jquery,jquery-selectors,clone
I am dynamically adding a div to my webpage when ever I click a button. I am doing this by cloning an original div and appending the clone. I have the above figured out. However, within the cloned div there is a text input. I want to make sure the...

Issue with jquery selectors within group & looping over elements

javascript,jquery,jquery-selectors
My issue is 2 fold. I have the following code: $photosContainer = $("#photos-fs") $photos = $photosContainer.find(".photo"); $length = $photos.length; if ($length > 1) { setTimeout(showNextPhoto, 3000); } function showNextPhoto() { //$current = $photos.eq(0); <-- this works //$next = $photos.eq(1); <-- this works $current = $photos.find(".current"); <-- this does not $next...

Assigning onclick via jQuery selector

javascript,jquery,jquery-selectors
I am trying to assign an anchor's onclick via javascript - see jsfiddle below: <a id="link_a" class="linka" href="http://www.google.com">link 1</a> var lnkA=$('.linka'); lnkA.onclick=function(){alert(this.innerHTML);}; fiddle: https://jsfiddle.net/andrewtr/tkfvyr7o/ Code: However, it doesn't seem to work. What am I doing wrong? Thanks!...

jQuery .not() selector not working with class [closed]

javascript,jquery,jquery-selectors
I'm trying to select all of the direct children of body, except for those that match a certain class. Whether I use the .not() filter or the :not() selector, the element I'm trying to filter out is STILL part of the selection when I filter by class name. However, if...

How to check if TD is last with class in row

javascript,jquery,jquery-selectors
I am new to jQuery and hope someone can help me with this. I have a large HTML table with dynamically added rows. The table has a standard structure (incl. thead, tbody and tfoot). Within this table there are editable TDs (which have the class "editable" and contain a contenteditable...

Get the next div and check that div for a class exists in it's childs

jquery,html,jquery-selectors
How do I determinate if one of the buttons have the class "selected"? <a id="foo">Foo</a> <div id="div"> <input type="button" /> <input type="button" class="selected" /> <input type="button" /> </div> I wrap foo into a jQuery object. Call next() to get to the div. How do I do the rest? function fooClickHandler(foo)...

jQuery button to show/hide multiple divs with same id

jquery,jquery-selectors,click,element,slidetoggle
I have many products being populated dynamically, all with same id and class names. I want each "Buy Now" button to have its own div that toggles with click of button. I do have the ability to assign an incrementing number index to the ids and classes, however, if there's...

How to select an element by it's value in jQuery?

jquery,jquery-selectors
I have the following HTML-source <tr> <td>Peter Pan</td> <td>Nervland</td> <td> <a href="edit/id-for-peterP">edit</a> <a href="delete/id-for-peterP">delete</a> </a></td> </tr> <tr> <td>Wendy</td> <td>Nervland</td> <td> <a href="edit/id-for-wendy">edit</a> <a href="delete/id-for-wendy">delete</a> </a></td> </tr> The task is to choose the edit-link in the row that also contains a...

jQuery with the plus sign

javascript,jquery,html,jquery-selectors
I wonder why jQuery doesn't allow "+" sign. Here is an example of how it works with "1" and "3" but not with "2+". Just mouse-over the text above every div. <div id="div-2+"></div> JSFiddle $('a.hover').mouseover(function() { dataI = $(this).data('i'); $('div#div-' + dataI).addClass('h'); }); $('a.hover').mouseout(function() { dataI = $(this).data('i'); $('div#div-' +...

how do I set .css backgroud url of a select box in jquery?

jquery,jquery-selectors
I have a select box and I would like to set its background url in jquery jQuery(document).ready(function($){ $('select').css({ ("background", "url("+site_url+"/img/select-arrow.png)") }); }); This code doesn't work...

jQuery selector: Selecting a certain combination of classes when multiple exist

javascript,jquery,jquery-selectors
I have tried to do some research already and haven't found anything, but If I've missed the answer, please tell me. Basically I have multiple elements with multiple classes each, but the combinations are unique. I want to select a certain combination of classes, but not other elements that have...

How do you select in-line text with Jquery?

javascript,jquery,jquery-selectors
How can I select the text infront of the unordered list below? <li class="foo"> How can I remove this text? <ul class="bar"> <li><a href="#">Link</a></li> </ul> </li> I tried doing something like this: $('ul.bar').previousSibling().remove(); But I think that would only work with another element, and I'm not entirely sure how to...

How to extend a jQuery selector that is stored in a variable?

jquery,performance,jquery-selectors
I have a jQuery selector stored in a variable, like so: var myVariable = $( ".js-selector" ); I'm wondering if and how I can use this variable to select children of this element, instead of writing: $( ".js-selector .some-child" ); How do I do this? I'm also wondering if I...

Click handler for element with highest z-index only

javascript,jquery,html,css,jquery-selectors
In a page I'm creating there are some WebGrid components serving as master grids, and on clicking a row, a details area is shown. Now every row shall also have a delete button, so that clicking this button, the row is deleted. Now because I have a click handler for...

Find all input with specific keyword [duplicate]

jquery,jquery-selectors
This question already has an answer here: jQuery selector for a checkbox that contains certain text in its name attribute 3 answers I'd like to find all the inputs that have at the end of their names the keyword [0]. I guess I have to use the following method:...

jQuery: How to combine two lines of code (with same target)

jquery,jquery-selectors
I am new to jQuery and am trying to combine the following two lines of code as they both target the same div ( $(this).closest('div.col-9').nextAll('div.hiddenDiv') ) and I have other, similar scenarios where this would reduce code as well: $(this).closest('div.col-9').nextAll('div.hiddenDiv').find('input, select, textarea').removeProp('checked').removeProp('selected').not(':button, :checkbox, :hidden, :radio, :reset, :submit').val(''); $(this).closest('div.col-9').nextAll('div.hiddenDiv').hide(); It works...

How to trigger neighbour element to “this” object in jquery

jquery,html,css,jquery-selectors
I have 1 button - <a> link and list - ul. I need to show/hide list when I click on button. Here is the code: <div class="wide-tile" id="tile-1"> <div class="size-set"> <a href="#" class="toggle-btn"> > </a> <ul class="size-list"> <li>1x1</li> <li>1x2</li> <li>2x1</li> <li>2x2</li> </ul> </div> <a href="details.html" class="wide-tile-link"> <span class="title">About us</span> </a>...

what is differences between $('element , #id') and $('element', '#id') in jquery

jquery,jquery-selectors
I know $('element, #id') selects all elements & #id. But what does do $('element', '#id') !? I only know they aren't similar. So what's difference?

trigger a click on multiple elements with the same class

javascript,jquery,jquery-selectors
I'm trying to trigger a click on multiple elements with the same class but when i do so the first element only get clicked and not the others, frankly I'm trying to make likes to all ask.fm profile answers by using the console of firefox so this is what i...

Concatenate CSS selectors

jquery,css,jquery-selectors,css-selectors
Is there a smarter way where I can use $self instead of using foo in $('.foo.bar')... ? It feels like the extra foo is redundent. I don't want to look through some selector I already found. $('.foo').on('click', function () { $self = $(this); $('.foo.bar').removeClass('bar'); // Works but feels wrong. //$self('bar').removeClass('bar');...

jQuery selector precedence when using pattern matching

javascript,jquery,javascript-events,jquery-selectors,event-handling
I am creating a form that implements a bunch of similar elements. They are custom select boxes, created out of <ul>s. Some of these elements are slightly different in the way I want the mousedown event to be handled though. The way I have it set up currently is that,...

Select a specific number of items of a specific type which are brothers with jQuery

jquery,jquery-selectors
I wish to add a class to pictures in a p only if they're strictly 2 pics in the p (not an alone img or more than 2), with a jQuery selector. <div class="wysiwyg"> <p> <img class="addHere"/> <img class="addHere"/> </p> <p> <img/> </p> </div> For now, I have something like...

Stored selector doesn't work correctly with each()

jquery,jquery-selectors
Below is a recreation of the problem I'm having. I stored $('.box') into the $box variable. In my actual code, I'm using $box in many places to do things and it works fine, except in the portion of code below, where I tried to use loop through the many $box's...

How do I get the dom element which has not rendered with javascript?

javascript,jquery,dom,jquery-selectors
I have a simple js code: <html> <head> <title>test</title> <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script> <script type="text/javascript"> console.log(document.querySelector('#nav-toggle')); // this will get null console.log($('#nav-toggle')); // this will get the element </script> </head> <body> <a id="nav-toggle" href="#">link</a> <script type="text/javascript"> console.log(document.querySelector('#nav-toggle')); // this will get the...

Add class to nth of an element found on full page instead within a parent

jquery,jquery-selectors,element,addclass
I'm trying to add classes to the "nth" of a particular element - regardless of where it falls on the page. A simplified version of my html is: <div class="row"> <div class="col-sm-12"><section class="subsection"></section></div> <div class="col-sm-12"><section class="subsection"></section></div> </div> <div class=“row”> <div class="col-sm-12"><section class="subsection"></section></div> <div class="col-sm-12"><section...

Using the this keyword with jQuery selectors

jquery,jquery-selectors,this
Can someone please help me with the syntax of using the jQuery this keyword? Here is my code that works: var obj = jQuery.parseJSON(data); $('.example_infobox1').addClass(obj.gridlayout); $('.example_infobox1 .info-box').addClass(obj.boxcolor); $('.example_infobox1 .info-box-icon').addClass(obj.iconcolor); $('.example_infobox1 i').addClass(obj.icon); $('.example_infobox1 .info-box-text').html(obj.text); $('.example_infobox1 .info-box-number').html(obj.number); Here is the code that I am working on: var obj = jQuery.parseJSON(data);...

select special selector after $(this) selector

javascript,jquery,html,jquery-selectors
for example I have this code <script> $(document).ready(function () { $('span').each(function () { $(this).html('<div></div>') ; if ( $(this).attr('id') == 'W0' ) { $( this > div ?!!! ).text('0') } if ( $(this).attr('id') == 'W1' ) { $( this > div ?!!! ).text('1') } if ( $(this).attr('id') == 'W2' ) {...

AddClass in jQuery on runttime and select the new class

jquery,class,jquery-selectors,onclick,addclass
I'd like to add a class to a div tag in runtime (after clicking the tag) and select the div tag by the new class name afterwards. Here is my code: HTML <div class="black" id="" style=""> black </div> CSS .black{ color:black; } .green{ color:green; } jQuery should remove class "black"...

jQuery XOR selector

javascript,jquery,jquery-selectors,xor
From a set of divs I want to select all the divs that contain a specific attribute and then select all the divs that do not contain any of the attributes. Example: <div data-attr="1"></div> <div data-attr="2"></div> <div data-attr="3"></div> <div data-attr="4"></div> <div data-attr="5"></div> var attrList = [3,4]; // I want to...

jQuery selector for second column in HTML table row

javascript,jquery,html,css,jquery-selectors
The aim of my code is to add the data from the selected HTML table row to the JavaScript array, and remove it if the row is unselected. https://jsfiddle.net/nicktry/h1636ram/ I have two problems at the moment: The CSS Style is not being applied on the 1st click I can't get...

How to set array value into textfield using selectize.js

javascript,jquery,jquery-selectors,selectize.js
Hello I have a problem regarding selectize. I tried and test this code to ensure that I get a list of email coming from the database. for(var i = 0; i < e.email.length; i++){ console.log(e.email[i]); var list = e.email[i]; } The results are fine and I get what I want....

JQuery .find() failing on an .ajax() result

jquery,html,ajax,google-chrome-extension,jquery-selectors
I'm working on a Chrome extension which, under certain conditions, performs a $.ajax() request and then uses information of specific elements in the returned HTML. For now, I'm simply trying to have it access the specific element and log it to the console to ensure it works correctly. To start,...

How is this selector working?

javascript,jquery,jquery-selectors
In the HTML I have the following element: HTML <input id="userNameTxt" type="text" class="input" value='ABC> And i am selecting it like this in jQuery: APP.js $(userNameTxt).val() What is this selector selecting? (Like when I use $('.something') -> it's selecting the Class of the element or $('#something') it's selecting the ID.) It...

Select specific element type with specific ID in jQuery

javascript,jquery,jquery-selectors
I want to find any canvas elements with the id whatever using jQuery. I thought I could do $('canvas #whatever') but that doesn't return anything when I have a canvas with that id on the page.

Jquery selector not working with dynamic .get loaded content

jquery,html,jquery-selectors,selector
I have a page that dynamically loads content with a .get request from clicking a button. The HTML page that loads I can not get any jquery selector to target anything on that page. I tried putting the script for the alert on the page that gets loaded as well...

How do I get the value in this neighboring element?

jquery,jquery-selectors
I'm having trouble with the jQuery part: HTML <div> xxxxxxxxx <div> <ul> <li><button class="addnum">xxxx</button></li> </ul> </div> </div> <div class="num"> 12345 </div> Script $(".addnum").click(function() { var pur = $(this).siblings(".num").clone(); }); I'm trying to clone the value inside ".num", which is 12345. How should I select it? *edit: sorry, I didn't mention...

Get group radio button selected value via jquery

javascript,jquery,html,jquery-selectors,radio-button
How can I get the selected radio button value via jQuery? I tried: var selectedPlan = $("input[name=Plan[packageId]]:checked'").val(); alert(selectedPlan); bBt didn't work. <td style="vertical-align: top;"> <input type="radio" value="1" name="Plan[packageId]"> <lable>3 Games</lable><br> <input type="radio" value="2" name="Plan[packageId]"> <lable>5 Games</lable><br> <input type="radio" value="3" name="Plan[packageId]"> <lable>10 Games</lable><br> </td>...

jQuery selector