Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (7k points)

How to access an HTML textbox by a javascript function?

1 Answer

0 votes
by (13.1k points)

You can use ID on text box and use document.getElementById() function like this:

<html>

<head>

<script type="text/javascript">

function insideTextBox()

{

  var textBox = document.getElementById('ID');

  // do something with it ...

}

</script>

</head>

<body>

<input type="text" id="ID">

</body>

</html>

Want to be a full stack developer? Check out the full stack developer course from Intellipaat.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...