javascript - this.class vs. this.getAttribute('class') -


i have radio button, , when pressed function called, accepts class of button argument. this:

<input class="myclass" type="radio" name="name" value="x" checked="true" onclick="myfunction(this.value, this.getattribute('class'))"></input> 

notice in onclick, have this.getattribute('class') instead of this.class. tried using this.class kept getting undefined. this.class not acceptable thing do? have used this.id elsewhere in code works fine, reason need use getattribute when want reference class.

so asking difference between this.class , this.getattribute('class')?

use classname current value of class attribute. think reason behind because class reserved word.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -