Reputation: 1188
I' m using MVC and set an itemId attribute to checkboxes.
@Html.CheckBox("check", false, new { itemId = item.ID })
Now I want to get this attribute with using javascipt but I could not.
I got the checkboxes list with this code:
var checkboxes = document.getElementsByName('check');
Are there any solution for it?
Upvotes: 0
Views: 79
Reputation: 8539
this should help:
var itemId = document.getElementsByName('check')[0].getAttribute('itemId');
Upvotes: 1