문제

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>

도움이 되었습니까?

해결책

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";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top