0
var append = $('<li class="ui-widget-content" id="list-'+num+'">'+content+'</li>');
console.log(append); // LOG: [object Object]
console.log(append.html()); // LOG: null
IE 8创建var append
作为对象,但其html内容为null
。在其他浏览器中正常工作。我无法弄清楚这里有什么问题。有任何想法吗?元素/对象在Internet Explorer中为NULL
// //编辑
var content
是一个Ajax响应HTML字符串,这样
<div class="item status-0 filiale-2" id="item-18">
<div class="ui-corner-all date ui-state-active">
<div class="filiale">Düren</div>
<div class="left date-add">22.06.2011 15:02:24 Uhr</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div>
<form id="form-order-18" action=""">
<input type="hidden" id="list-id" name="id" value="18" >
<div class="relative left artikel"><input type="text" class="text ui-corner-all ui-widget-content autocomplete" id="list-artikel-18" name="artikel" value="79949 | ASUS Eee PC 1001PXD-BLK028S 25.65cm/N455/1" /></div>
<div class="relative left qty"> <input type="text" class="text ui-corner-all ui-widget-content" id="list-qty-18" name="qty" value="1" /></div>
<div class="relative left comment"><input type="text" class="text ui-corner-all ui-widget-content" id="list-comment-18" name="comment" value="kunde wünscht ungeöffnetes" /></div>
<div class="relative left">
<button type="button" class="item-edit" opt:icon="ui-icon-disk" opt:text="false">Änderungen speichern</button>
<button type="button" class="item-del" item:id="18" opt:icon="ui-icon-trash" opt:text="false">Bestellung Löschen</button>
</div>
</form>
</div>
<div>
<form id="form-sendorder-18">
<input type="hidden" name="action" value="sendorder" />
<input type="hidden" id="order-id" name="id" value="18" >
<div class="relative left salesman">
<label for="order-artikel-18" class="ui-state-disabled text">Händler</label>
<input type="text" class="text ui-corner-all ui-widget-content acsalesman inlinefield" id="order-artikel-18" name="salesman" value="" />
</div>
<div class="relative left dateexpected">
<label for="order-list-date-expected-18" class="ui-state-disabled text">erwartet am</label>
<input type="text" class="text ui-corner-all ui-widget-content inlinefield datepicker" id="order-list-date-expected-18" name="date_expected" value="" />
</div>
<div class="relative left comment">
<label for="order-comment-18" class="ui-state-disabled text">Kommentar für Filiale</label>
<input type="text" class="text ui-corner-all ui-widget-content inlinefield" id="order-comment-18" name="comment_o" value="" /></div>
<div class="relative left">
<button type="button" class="item-order" opt:icon="ui-icon-cart" opt:text="false" item:id="18">Ware Bestellt</button>
</div>
</form>
</div>
<div class="clear"></div>
这个字符串就是问题所在。如果我没有这个字符串设置的HTML,它的作品。
var append = $('<li class="ui-widget-content" id="list-'+num+'">foobar</li>');
console.log(append); // LOG: [object Object]
console.log(append.html()); // LOG: foobar
感谢&问候,
亚历
什么是'content'?哪个IE?已经有十次了。 [在IE8中为我工作](http://jsfiddle.net/a698W/)。 –
无法在IE8中重现。 – DanielB
尝试将'console.log(append);'切换到'alert(append);'。与其他console.log相同。我看到一些版本的IE浏览器使用console.log引起了烧心。值得一试;这很容易做到,它可能有助于缩小问题的范围。 –