开发者

HTML forms losing all styles on ajax form submit

开发者 https://www.devze.com 2023-03-23 06:17 出处:网络
I have an issue that i cannot seem to get to the bottom of! I have a series of forms generated via a jQuery plugin that render fine and all is good in the hood, however whenever I submit the form (vi

I have an issue that i cannot seem to get to the bottom of!

I have a series of forms generated via a jQuery plugin that render fine and all is good in the hood, however whenever I submit the form (via a button calling an AJAX funct开发者_高级运维ion) on success of the AJAX call the form loses all styles and defaults back to browser defaults.

This is really doing my head in as it ruins the who style layout of the site.

Cheers.


I'm not sure without more context, but this sounds like a common issue that's caused by the fact that AJAX postback doesn't trigger the code that's styling everything. You can get around this like so:

$(function () {
  doThatStyling();
});

$(document).ready(function () {
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

  function EndRequestHandler(sender, args) {
    doThatStyling();
  }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消