String length : String « Data Type « JavaScript DHTML
- JavaScript DHTML
- Data Type
- String
String length
<html>
<body>
<p id="myP">How many characters in this sample text?</p>
<button onclick="function1();">Click me to find out</button>
<script language="JavaScript">
function function1() {
var m = "How many characters in this sample text?".length;
alert(m);
}
</script>
</body>
</html>
Related examples in the same category