Input Text size Property - Get the width of a text field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Input Text size Property - Get the width of a text field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Name: <input type="text" id="myText">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*  ww w  . j a  v  a2 s  .  co m*/
    var v = document.getElementById("myText").size;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials