answersLogoWhite

0

What is the use of id in javascript?

Updated: 8/21/2019
User Avatar

Wiki User

10y ago

Best Answer

ID in JavaScript can be used to refer a control. For example getElementbyID("#name-of-id").

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the use of id in javascript?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Insert date on a webpage using javascript?

Just use new Date(); to get the current date and then use document.getElementById to insert it on the webpage. <div id="example"></div> <script type="text/javascript"> document.getElementById('example') = new Date(); </script>


How do you put a JavaScript variable into the value of a HTML text box?

If your text box has the ID foo and your JavaScript variable is named bar, then you can use the following code to put the value of the variable into the text box:document.getElementById("foo").value=bar;


What does documentation do?

The instruction document.getElementById is used in JavaScript, followed by a unique ID. It identifies and returns the HTML element that has the specified ID.


Can you use javascript in Mozilla?

Yes. In fact, you can use JavaScript in any web browser.


How do you add text to an already existing p tag in JavaScript or PHP?

Consider your HTML <p id="pid">Hello </p> In javascript document.getElementById('pid').innerHTML="world"; Remember "id" are unique on the HTML page hence js will always pick <p> where id=pid.


Java projects which does not use database?

JavaScript is a computer language that is mostly used in web browsers. An example of JavaScript project without a database is called a login session, this requires a lot of hard coding and requires a lot of multiple ID comparison.


How do you use javascript in aspnet?

Ajax, I believe uses JavaScript + ASP.


How do you call javaScript function inside table?

<table> <th onclick="checkData()">ID</th> <th onclick="checkData()">Name</th> </table> <script type="text/javascript" language="javascript"> function checkData() { // Your Javascript code here alert("It Works"); } </script>


What is a node id?

It is the value of the attribute id of a node. It is used when manipulating the DOM and can be accessed by using the function getElementById() of the document object in JavaScript


What is the uses of getelementbyid in javascript?

ID is unique and there can be no duplicate in concerned file atleast. When you specify the document.getElementById command then that means javascript only calls that element. Say suppose you want to call a radiobox of name gender where the name gender is associated with two form elements. Here you specify two different ID's and call them through javascript


How do you get the popup javascript box?

Use confirm or alert in javascript code to get a popup


How do you show the text box output in the browser using Ajax code?

You can directly do that in the JavaScript. Just get the value of the input type in JavaScript using id and show it using .innerHTML.