How can I select an element with multiple classes? I want to select all the elements that have the two classes a and b. <element class="a b"> So, only the elements that have both classes. When I use $(".a, .b") it gives me the union, but I want the intersection. Answer: If you want an intersection, just write the selectors together without spaces in between. $('.a.b') So for an element that has an ID of a with classes b and c, you would write: $('#a.b.c') http://stackoverflow.com/questions/1041344/how-can-i-select-an-element-with-multiple-classes
undefined
Get selected text from a drop-down list (select box) using jQuery How can I get a drop-down list selected text in jQuery, not using the selected value? Answer: $("#yourdropdownid option:selected").text(); http://stackoverflow.com/questions/1643227/get-selected-text-from-a-drop-down-list-select-box-using-jquery
undefined
How to get the children of the $(this) selector? I have a layout similar to this: <div id="..."><img src="..."></div> and would like to use a jQuery selector to select the child img inside the div on click. To get the div, I've got this selector: $(this) How can I get the child img using a selector? Answer: The jQuery constructor accepts a 2nd parameter called context which can be used to override the context of the selection. jQuery("img", this); Which is the same as using .find() like this: jQuery(this).find("img"); If the imgs you desire
undefined
How can I know which radio button is selected via jQuery? I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected? Answer: To get the value of the selected radioName item of a form with id myForm: $('input[name=radioName]:checked', '#myForm').val() Here's an example: $('#myForm input').on('change', function() { alert($('input[name=radioName]:checked', '#myForm').val()); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="myForm"> <input type="radio" name="radioName"