Add some text in input box and click on Add Message button:
Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function showMessage() {
var message = jQuery("#textToDisplay").val();
jQuery("#messageSpan").text(message);
}
</script>
</head>
<body>
<input type="text" id="textToDisplay" />
<input type="button" value="Add message" onClick="showMessage()" />
<div>
<span id="messageSpan"><span>
</div>
</body>
</html>
Most Helpful This Week
JavaScript check if first string contains all characters of second string
jQuery Show or Hide text on button click
How to the length of the longest word in the provided sentence?
How to show hide option list items using jQuery?
How to declare multiple variables in one statement in Javascript?
JavaScript sort multi dimensional array on specific columns