Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test if the HTML attribute is present and get the value

I am trying to test if the HTML attribute is present and get the value using has Attribute("tabindex") property. But I am getting the below error:

Unable to get property 'hasAttribute' of undefined or null reference

I am using jGrid and jQuery. If the attribute is present I am trying to get the value of that particular td.

Please refer to the code below:

<tr class="jqgrow ui-row-ltr ui-widget-content  myAltRowClassEven ui-state-highlight" tabindex="0" id="2" role="row" aria-selected="true">
    <td aria-describedby="jqGrid11_cname" title=" TESTTHIS" class="zeroBorderRight" style="text-align: left; height: 20px;" role="gridcell">
        TESTTHIS
    </td>
</tr>
like image 219
user3213490 Avatar asked Aug 10 '16 18:08

user3213490


1 Answers

Try this:

$("#item").attr("tabindex")
like image 148
Mario Zamora Avatar answered Nov 04 '22 18:11

Mario Zamora