About document.getElementID? Explain giving one example.
This was asked by a interviewer when i said that i know
some JavaScript.
Answer Posted / kishore.gsgs
using this u can access any html elements by its id.Here we
are going to access <input> textbox by its id("abc").when we
click on
submit button javascript execute and <tr> will not be displayed
<html>
<head>
<script type="text/javascript">
function change()
{
alert("success");
alert(document.getElementById("kishore").value);
}
</script>
</head>
<body>
<input type="text" id="kishore">
<input type="button" name="submit" value="submit"
onClick="change()"/>
</body>
</html>
| Is This Answer Correct ? | 7 Yes | 3 No |
Post New Answer View All Answers
How can the style/class of an element be changed?
How to create an array in javascript?
What is the use of spread operator?
What are the variables in javascript?
What is the difference between ‘function declaration’ and ‘function expression’?
what does javascript null mean?
What do you use javascript for?
What is the use of Push method in JavaScript?
Explain the unshift() method ?
What are classes in javascript?
What is the difference between == and ===? Which one would you use?
What is the difference between window and document in Javascript?
Is jquery easier than javascript?
Is JavaScript a true OOP language?
Is javascript object a hash table?