Home  >  jQuery

Example of Descendant Selector in jQuery

May 01, 2013
Descendant Selector means, the nested element can be selected and we can use for own cause. As an example inside a div, then inside span if we have an element text, we can select that and use that one. Sample example is given below.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
   <input type=text value="yellow"/>
 <input type=text value="blue"/>
<input type=text/>
$( "div input" ).css( "backgroundColor", "blue" );
$( "div span input" ).css( "backgroundColor", "yellow" );


©2022 concretepage.com | Privacy Policy | Contact Us