About document.getElementID? Explain giving one example.
This was asked by a interviewer when i said that i know
some JavaScript.
Answer Posted / negi
using this u can access any html elements by its id.Here we
are going to access <tr> by its id("abc").when we click on
submit button javascript execute and <tr> will not be displayed.
<html>
<head>
<title>xxx</title>
<script language="javascript" type="text/javascript">
function change()
{
document.getElementById("abc").style='none';
return true;
}
</script>
</head>
<body>
<table>
<tr id="abc">
<td>you are great</td>
<td><input type="submit" name="submit" value=""
onClick="return change();"/></td>
</tr>
</table>
</body>
</html>
| Is This Answer Correct ? | 17 Yes | 6 No |
Post New Answer View All Answers
What is ‘this’ keyword in JavaScript?
What's the Difference Between Class and Prototypal Inheritance?
What is the difference between innerHTML and innerText?
What is a module code?
What does “1?+2+4 Evaluate to? What about 5 + 4 + “3??
What is meant by vanilla javascript?
Why typeof null is object?
What is servlet in javascript?
What is the difference between remove() and removeChild()?
Define anonymous function.
What is the difference between null & undefined?
Explain the term closure?
Define escape() function?
Explain mul function in javascript?
what difference between args.length and args.length() in command line argument?