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
How do I link an external javascript file to html?
What is meant by vanilla javascript?
Why is javascript dangerous?
Write a program in Java to display the IP address of the local and remote machine.
Name some of the built-in methods and the values returned by them.
Is javascript faster than asp script?
Can we learn javascript without knowing java?
How to access the value of a textbox using javascript?
What are the data types supported by javascript?
What is lazy instantiation in java?
Write a main method that prompts the user to enter the starting population, birth and death rates, and the number of years. The input birth and death rates cannot be negative, the starting population cannot be less than 2, and the number of years greater than 0. If the user enters an invalid value, this program will prompt user to re-enter the value until a valid value has been read. When all input values are valid, call on the methods above to compute estimated population and print result.
How do I open a .js file?
How to delete a cookie using javascript?
Explain javascript debounce function?
What is the data type of variables in javascript?