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
How to the length of the longest word in the provided sentence?
jQuery Show or Hide text on button click
Image Rollover Using onMouseOver and onMouseOut
jQuery move multi select values from one to another multi select list
How to change text after click event using JavaScript?
How to scroll page to 1000px from top on page load using jQuery?