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 to write html code dynamically using JavaScript?
why can't we call a static method from a non-static method
How to create arrays in javascript?
How to write a function in javascript?
Why is it called javascript?
Why do we use javascript?
How do I turn on javascript?
What is the javascript function?
What is double exclamation point?
How to convert a string to a number using javascript?
Difference between '=', '==' and '===' operators?
Event bubbling and Event Capturing in JavScript?
What javascript method would convert the string “20” to an integer (on the fly) so “20” + 20 = 40?
What kind of conditional statements does JavaScript support?
How typeof operator works?