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 the use of let & const in javascript?
How do you trim in javascript?
How do you change the style/class on any element?
What does window.print() do in Javascript?
What are the primitive data types in JavaScript?
Explain closures in javascript?
What is event target in javascript?
How many types of functions JavaScript supports?
List some features of javascript.
What is the difference between textContent and innerText?
How do I add javascript to chrome?
java pgm for reads a file(text file) and removes all the spaces then the text and write this back into the same file. e.g: (Input) _______ chennai is fourth biggest city in india. (output) _______ chennaiisfourthbiggestcityinindia.
What is difference between java and javascript?
How to create an array in javascript?
What's the purpose of javascript?