Write a javascript code to accept any string from user count the length of the string and display in alert()
Answers
Answered by
1
Correct Question:-
Write a javascript code to accept any string from user count the length of the string and display in alert()
Code:-
I am writing only the script.
Write this within script tag.
function myFunction()
{
var x=prompt("Please enter a String: ","");
alert(x.length);
}
Now, write the html code below,
<html>
<body>
<button onClick="myFunction()">Click Here</button>
</body>
</html>
Similar questions
Math,
3 months ago
India Languages,
3 months ago
Math,
3 months ago
Math,
6 months ago
History,
6 months ago
Science,
11 months ago
India Languages,
11 months ago