javascript - Accessing a particular DOM element -
how access <li>jquery chumps!</li>
element? not have id i'm not sure do. i'm going store in variable
<!doctype html> <html> <head> <title>simplify, simplify</title> <script type='text/javascript' src='script.js'></script> </head> <body> <div> remember! <ul> <li> <ol> <li>start function keyword</li> <li>inputs go between ()</li> <li>actions go between {}</li> <li>jquery chumps!</li> </ol> </li> <li>inputs separated commas.</li> <li>inputs can include other functions!</li> </ul> </div> </body> </html>
you can this:
var selector = $('ol li:last');
more specific adding id or class parent div , this:
var selector = $('#parent ol li:last');
or, if can anywhere in ol can use contains:
var selector = $('#parent ol li:contains("jquery chumps!")');
Comments
Post a Comment