Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
what is the work of java script function getElementById()
Posted

<input id="btnok" type="button" value="button" />
<input id="Button1" type="button" value="button" />
<div id="div1" />
<div id="div2" />
<script type="text/javascript">
 
document.getElementById("btnok").value; //It works on only that element which match the id with "btnok" or you can say      works on unique Id.


document.getElementsByTagName("div").length; //It works on all  that element which have the tag name "div"  
   
   </script>
 
Share this answer
 
v4
I think this link[^] will help you.
 
Share this answer
 
v2
you can either utilise javacripts' GetElementById() method, or you use Jquery Library and use the Jquery selector:

JavaScript
// where you enter id of element after hashTag
$('#IdOfControl')

// or you can select anything with a certain class :
$('.class1')
 
Share this answer
 
Google it, and do not try to post these type of questions in code project.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900