so I have:
<span selected="Y" onclick="change();">Click here to test~</span>
<script src="jquery-1.7.2.js"></script>
<script>
function change()
{
$('span[selected=Y]').attr("selected","N");
}
</script>
When I clicked the span, and checked the attribute of the span using firebug, the attribute “selected” changed to “selected” instead of “N”.
so the result is selected=”selected” !!??
How come it did not change to selected="N"
selectedis not valid attribute tospan, instead of that you can usedata.jQuery
Read more about jQuery .data()