jquery - .addClass - Object Gold has no method 'addClass' -


i'm having little problem. keep getting following error when trying change style / add style:

object gold has no method 'addclass' 

this code in .js file:

 function getselectedcoverlevel(id) {           selectedlevel = $(id).attr('id');         selectedlevel.addclass("selectedboo");   } 

and html file:

<a href="javascript:void(0)" onclick="getselectedcoverlevel(this);" id="gold"  class="btn green"> 

it's simple can't see @ moment.

since passing dom element reference getselectedcoverlevel, need jquery wrapper element provides access jquery utility methods.

in case assigning id attribute of element selectedlevel string , no have method addclass

var selectedlevel = $(id).addclass("selectedboo"); 

Comments