This article describes the method of JavaScript dynamically modifying web element content. Share it for your reference. The specific analysis is as follows:
The following JS code When the user clicks the submit button, dynamically specify the content of the element through the element's textContent or innerHTML.
<script type="text/javascript"> function showCard() { var message = ("CCN").value; var element = ("mycreditcardnumber"); = message; //for Firefox = message; //for IE (why can't we all just get along?) return true; } </script> <form name="dynamic" method="get"> <span>Enter Your Credit Card Number:</span> <input type="text" name="CCN" value="CCN" /> <input type="button" value="submit" onclick="showCard()" /> </form> <p>Verify your Credit Card Number: <span >0000-00-0000-00 </span> </p>
I hope this article will be helpful to everyone's JavaScript programming.