Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<body>
<div id="div1">This is javascript !</div>
<button onclick="myfunction()">click</button>
<div id="test"></div>
<script>
function myfunction() {
var str = document.getElementById("div1").innerHTML;
var post = str.search("javascript");
document.getElementById("test").innerHTML = post;
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body >
<script>
var str = "I am years old!";
if (str.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)) {
$("body").text("it is ok");
}
else
{
$("body").text("Please type numeric and alphabetic characters");
}
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507