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 a currying function?
Explain the difference between call() and apply()?
What is noscript tag?
How would you compare two objects in JavaScript?
What is called variable typing in javascript?
How many types of data types are there?
What is foreach loop in javascript?
What is array in javascript?
How do I turn off javascript in chrome?
What is the difference between the operators ‘==‘ & ‘===‘?
What is js injection?
How can you identify a function?
What is 'use strict'?
What is the difference between scripting and programming?
Where do I put javascript code in html?