ArnisR Posted August 17, 2011 Report Share Posted August 17, 2011 var item = $('<div>', { class: "my-block", html: "Hello!" }); Uz IE8 nestrādā šādi veidots objekts, un kā izrādās vainīga ir "class" opcija! Kāpēc tā notiek, un kā to var labot ? Quote Link to comment Share on other sites More sharing options...
codez Posted August 17, 2011 Report Share Posted August 17, 2011 var item=$('<div class="my-block">Hello!</div>'); Quote Link to comment Share on other sites More sharing options...
ArnisR Posted August 17, 2011 Author Report Share Posted August 17, 2011 var item=$('<div class="my-block">Hello!</div>'); tā jau mēģināju, bet tad vairs nestrādā "html" opcija Quote Link to comment Share on other sites More sharing options...
codez Posted August 17, 2011 Report Share Posted August 17, 2011 Šādi visam vajadzētu strādāt (man arī uz IE6 strādā): http://jsfiddle.net/FDzDB/ var html='Te dzīvo html'; var item = $('<div class="myclass">'+html+'</div>').appendTo('body'); Quote Link to comment Share on other sites More sharing options...
briedis Posted August 17, 2011 Report Share Posted August 17, 2011 (edited) var item = $('<div class="my-block">Hello!</div>');item.html("trololol");item.attr("class", "my-block"); Kur problēmas? Edited August 17, 2011 by briedis Quote Link to comment Share on other sites More sharing options...
ArnisR Posted August 17, 2011 Author Report Share Posted August 17, 2011 <pre class="prettyprint"> var item = $('<div class="my-block">Hello!</div>');item.html("trololol");item.attr("class", "my-block"); Kur problēmas?</pre> Problēmu arī nebij darīt pēc tava parauga, vienīgi tas pirmais variants ir daudz ērtāks pieraksta ziņā (vismaz man). Šķiet atradu risinājumu - class jāliek pēdiņās. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.