I'm attempting to make every ".inputbox" element except the last one
read-only on my webpage. Firefox and IE comply but Safari and Chrome
apply "readonly" to ALL ".inputbox" elements on the page, even the
last one.

I've narrowed down my issues to the selector in this line:

$(".inputbox:not(:last)").attr("readonly", "readonly");

Am I missing something in this selector, or is there a problem with
Webkit? (I'm assuming Webkit since the problem spans Chrome and Safari
only.) One can reproduce this by using this HTML file:

<html>
<head>
<title>jQuery Not Selector Test Case</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function doTest() {
        $(".inputbox:not(:last)").attr("readonly", "readonly");
}
</script>
</head>
<body>
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />
<input type="text" class="inputbox" value="Testing" /><br />

<button onclick="doTest()">Test me</button>
</body>
</html>

Reply via email to