I have a razor view with:
<select id="roletypeddl" >
<option value="@roletype.Id" selected="selected" data-assignabletoperson="@roletype.AssignableToPerson" >@roletype.Name</option>
</select>
So in jquery I wanted to run some code if data-assignabletoperson was true hence:
if ($('#roletypeddl').find('option:selected').data('assignabletoperson') == true)
{
do something
}
Trouble is this code is never getting executed.
I figure it has to do with the html being produced being:
<select id="roletypeddl">
<option data-assignabletoperson="True" selected="selected" value="5">Manufacturer</option>
</select>
I think the problem is that the "True" is capitalised. Anyone know how to get around this?