0

After a user clicks "Save" on NewForm.aspx, I'd like to show/hide a div tag with a message instead of returning the user to the list showing all the responses. My tags are below, but I just can't figure out how/where to take over the built in "Save" button that is displayed in NewForm.aspx to then dynamically change the style of the div tag.

<div class="success" style="display: none;">
    <div class="alert alert-success" role="alert"><i class="fas fa-thumbs-up"></i>Request Submitted!</div>
</div>
<div class="failure" style="display: none;" >
    <div class="alert alert-danger" role="alert"><i class="fas fa-exclamation-triangle"></i>Submit Failed!</div>
</div>

1

The style display property is used to hide and show the content of HTML DOM by accessing the DOM element using JavaScript/jQuery.

To hide an element, set the style display property to “none”.

document.getElementById("element").style.display = "none";

To show an element, set the style display property to “block”.

document.getElementById("element").style.display = "block";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.