jQuery html attribute not working in IE

前端 未结 24 2546
[愿得一人]
[愿得一人] 2020-12-01 14:32

I am using country and state dropdowns in my form. Whenever the user selects the country in the dropdown, the respective states of the country will populate in the states dr

相关标签:
24条回答
  • 2020-12-01 14:45

    I had a issue on IE using this:

    $('#valor_total').html(valor_total); 
    

    where id had the same name as the variable passed as a parameter. Changing the id worked well:

    $('#div_valor_total').html(valor_total); 
    
    0 讨论(0)
  • 2020-12-01 14:46

    Are you using 1.4.2? There's an issue with the cleanData method using invalid cache entries in IE. The bug and corresponding fix can be found here. This affects calls to .html()

    0 讨论(0)
  • 2020-12-01 14:46

    Adding the no cache attribute to the controller fixed this for me.

    Copied from this answer: https://stackoverflow.com/a/12948321/1389589

    0 讨论(0)
  • 2020-12-01 14:48

    I had the same problem and found that the simplest solution was to use the replaceWith() function.

    0 讨论(0)
  • 2020-12-01 14:49

    I just ran into the same issue and none of the suggested fixes helped. Turns out tab characters in the passed string were the cause. As soon as I removed all of them, both html() and append() worked just fine. Guess no formatted strings for IE.. hmpf.

    0 讨论(0)
  • 2020-12-01 14:50

    As the solution is not mentioned here: I just had the same problem in IE8 when activating compatibility mode. The solution was to pass in a jQuery object to the .html() function like this:

    $("select#edit-state").html($(options));
    

    This was not a problem if the options were a jQuery object and also built as one. But in the above example, this should do the trick - at least for me it did.

    0 讨论(0)
提交回复
热议问题