This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15742|Reply: 0

[Bootstrap] The Bootstrap modal setting does not cache data

[Copy link]
Posted on 11/9/2015 11:00:19 AM | | | |


The modal dialog of the front-end framework Bootstrap can be specified with a URL using the remote option, so that the dialog will automatically load data from this address into the .modal-body when it pops up for the first time, but it will only load once, although this problem can be solved by calling the removeData() method in the event.

After searching and consulting the relevant documentation, I found that it is enough to write a statement in the hidden event of the dialog box:

  1. $("#myModal").on("hidden", function() {
  2.     $(this).removeData("modal");
  3. });
Copy code
You can also remove data before opening the dialog each time, and the effect is the same.

Note: The above code is based on Bootstrap v2, if you use Bootstrape v3, the HTML of the modal dialog and the event are written differently, for example, for the hidden event above, to write as:


  1. $("#myModal").on("hidden.bs.modal", function() {
  2.     $(this).removeData("bs.modal");
  3. });
Copy code






Previous:Teach you to open a luxury green diamond business on your behalf, you can earn about 60 yuan per order, which is easy
Next:About .net Execution Stored Procedure Null Automatically Becomes Default Exception Handling Method
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com