這在Opera中工作,但顯然沒有別的。JQuery - 按屬性選擇?
HTML
<input type="checkbox" name="iphone" value="checked" checked="checked" />
<input type="checkbox" name="photocart" value="checked" checked="checked" />
JS
$("input[name=iphone]").attr('checked', 'checked');
$("input[name=photocart]").attr('checked', 'checked');
$("input[name=iphone]").attr('disabled', 'disabled');
$("input[name=photocart]").attr('disabled', 'disabled');
我也曾嘗試以下無濟於事。
$("input[name|=iphone]").attr('checked', 'checked');
$("input[name|=photocart]").attr('checked', 'checked');
$("input[name|=iphone]").attr('disabled', 'disabled');
$("input[name|=photocart]").attr('disabled', 'disabled');
$("[name=iphone]").attr('checked', 'checked');
$("[name=photocart]").attr('checked', 'checked');
$("[name=iphone]").attr('disabled', 'disabled');
$("[name=photocart]").attr('disabled', 'disabled');
$("[name|=iphone]").attr('checked', 'checked');
$("[name|=photocart]").attr('checked', 'checked');
$("[name|=iphone]").attr('disabled', 'disabled');
$("[name|=photocart]").attr('disabled', 'disabled');
對他們中的任何人都沒有喜樂。有關我如何能夠實現這一目標的任何想法?
編輯: - 史詩失敗的HTML SORRY複製!
你發佈的標記有'name'「hosting」,但是你的選擇器都沒有在尋找這個,你可以發佈這個JS正在尋找的標記嗎? – 2010-09-15 11:51:09