I am disabling a form based on a checkbox...
I am having trouble adding the disabled attribute.
here is what I got so far: HTML:
<table id="shipInfoTable">
<tr>
<td>Name:</td>
<td><input type="text" name="name" /></td>
</tr>
...
</table>
Javascript selector/attribute manipulation(jquery):
$("#shipInfoTable tbody tr td input").each(function(index, item){
item.attr("disabled", true);
});
Chrome Dev Console error:
Uncaught TypeError: Object #<an HTMLInputElement> has no method 'attr'
When I alert out the item
within the .each()
it alerts [object HTMLInputElement]
Not quite sure how to select the input element properly. What am I doing wrong?
.prop("disabled", true)
. I'm pretty sureattr
didn't do was was intended anyway. – Onomastics