var parent = $("#jcontent"); var button1 = parent(".button1")
How to select .button1
knowing it is inside the parent while not reusing #jcontent
?
I need to do this because I only want to pass the parent as parameter and to be able to cache it which is faster.
Syntax of jQuery Select Option$(“selector option: selected”); The jQuery select option is used to display selected content in the option tag. text syntax is below: var variableValue = $(“selector option: selected”).
You can use the children property of getElementById() method in JavaScript to get or extract unique ids of all the DIV elements inside a DIV element.
If you have a variable containing a DOM element, and want to select elements related to that DOM element, simply wrap it in a jQuery object. var myDomElement = document. getElementById( "foo" ); // A plain DOM element.
The :odd selector selects each element with an odd index number (like: 1, 3, 5, etc.). The index numbers start at 0. This is mostly used together with another selector to select every odd indexed element in a group (like in the example above). Tip: Use the :even selector to select elements with even index numbers.
Another alternative
var parent = $("#jcontent"); var button1 = $(".button1", parent) ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With