简体   繁体   中英

How to hide a div after clicking javascript:history.go in with Javascript

I have a form and after submiting it I have a review page. If user wants to edit something in the form I use

<A HREF="javascript:history.go(-1)">Edit</A>

By this way I don't have to repopulate datas from somewhere. It basically goes backward. The problem is when I turn back to page, If I have form validation errors from previous page, It still remains there. Therefore, what I want to do is to hide the div id/class when I click Edit button. Form validation error are in a div so probably solution with hiding it will be better.

Thanks

$(document).ready(function() {
  $("#yourDivId").hide();
});

在EDIT按钮上调用javascript函数,而不是调用history.go(-1),并且在该javascript函数内部首先切换要隐藏的div,然后再进行history.back

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM