【发布时间】:2010-09-10 15:57:28
【问题描述】:
以下代码我无法开始工作 (Jquery 1.4.2) 似乎选择器不起作用,因为在 id=p_quantity 之后它没有做任何事情。我添加了 .remove() 只是为了查看是否是该行有问题,并且它没有在兼容模式下删除文本框,在常规模式和 FF 下工作。难倒!!!
EDIT 这行不起作用。
$("input[type='textbox'][name^='QTY']").attr('id','p_quantity').remove();
有趣的是,两个图像输入的第二次删除在 IE COMP 模式下工作正常
<table cellspacing="0" cellpadding="3" border="0"><tr><td>
<span class="PageText_L71n">Qty</span>: <input type="textbox" name="QTY.LL24" size="3" maxlength="7" onkeydown="javascript:QtyEnabledAddToCart();" value="1">
</td><td>
<input type="image" src="/v/vspfiles/templates/moderntot/images/buttons/btn_addtocart.gif" name="btnaddtocart" alt="Add to cart" border="0">
<input type="hidden" name="ReplaceCartID" value="" />
<input type="hidden" name="ProductCode" value="LL24" />
<input type="hidden" name="e" value="" />
<input type="hidden" name="ReturnTo" value="ShoppingCart.asp" />
<input type="image" src="/v/vspfiles/templates/moderntot/images/buttons/btn_addtowishlist.gif" name="btnaddtowishlist" alt="Add To Wish List" border="0" />
</td></tr>
</table>
<script type="text/javascript" language="javascript">
$(function(){
$("input[type='textbox'][name^='QTY']").attr('id','p_quantity').remove();
$("input[type='image'][name^='btnadd']").attr('id','button').remove();
});
</script>
【问题讨论】: