Reputation: 81
I am using this method on rowmouseevent
$get(eventArgs.get_id())
gives the ouput as
<tr class="normal" data-value="normal" id="ctl00_ContentPlaceHolder1_UserGrid_grdusergrid_ctl00__0" style="height:30px;" /tr>
How can I get the "class" attribute value of that
I am trying like
$get(eventArgs.get_id()).attr("class")
which is throws error as below "Object # has no method 'attr'"
Thanks
Upvotes: 0
Views: 182
Reputation: 2503
$get is a function from the (now depreciated) ms ajax core JavaScript library and attr is jquery function. So you have to wrap your $get element with $(Jquery) to use attr like:
$($get(eventArgs.get_id())).attr("class")
or If you know the element id then you can directly use
$('#Id).attr("class")
Upvotes: 2
Reputation: 16019
If $get
(don't know what that is) really returns that HTML node, you still have to wrap it with jQuery to enhance it with all the features, like attr
:
$get(eventArgs.get_id()) // return <tr class="normal" ... etc ...
$($get(eventArgs.get_id())) // returns jquery object, with <tr class="normal ...
$($get(eventArgs.get_id())).attr("class") // now you can do this
Upvotes: 1
Reputation: 3965
Try this:
var className = $('<tr class="normal" data-value="normal" id="ctl00_ContentPlaceHolder1_UserGrid_grdusergrid_ctl00__0" style="height:30px;" ></tr>').attr('class');
or
var obj = $("'" + $get(eventArgs.get_id() + "'").attr('class');
Upvotes: 0