In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use the preventDefault () method in jQuery, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.
The preventDefault () method prevents the default behavior of the element (for example, blocking the submission of the form when the submit button is clicked).
JQuery event-preventDefault () method example
Prevent links from opening URL:
$("a") .click (function (event) {
Event.preventDefault ()
})
E.preventDefault (); syntax
Event.preventDefault ()
Parameter description
Event is required. The default action that specifies which event to block. This event parameter comes from the event binding function.
First of all, the Table page, click the edit of one line, display the whole line of information on the Form form of the Modal page, directly cancel the Modal page, and click the edit of other lines again, the Form form of the Modal page can display the information of the new line normally.
However, if you click the submit button on the From form, close the Modal page, and then click another row edit, Modal's Form form still displays the previous line of information.
/ / submit
HandleSubmit= (e) = > {
E.preventDefault ()
This.props.form.validateFields ((err,values) = > {
/ / clear the default value of form
This.setState ({
MEMail:''
MPhone:''
MName:''
})
})
}
Although the Form content is cleared every time Modal is turned off, the default value of the printed Form is normal when it is displayed again.
But the previous message is on the page.
Finally, you choose to comment out e.preventDefault ();.
Thank you for reading this article carefully. I hope the article "how to use preventDefault () method in jQuery" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.