Hi How can I get hold of elements within a Div that uses a class say “sample”?
There are many Div’s in the document
<div class="sample"/>
..
<div class="sample"/>
..
<div class="sample"/>
..
<div id = "samplediv">
<div class="sample">
<div>
</div>
My question was to find the div with class sample and manipulate some properties of this div. So I want to get hold of the Div with class = “sample”?
In most modern browsers, you can get objects by class name using the function:
This is available on any element, including
document(as indocument.getElementsByClassName). Problem is, older browsers don’t support this. Instead, you can use jQuery to do the same thing:Hope this helps!