I'm attempting to update the css within a div using its id via :
$(this.id).removeClass("myCss");
Should'nt this work ?
I'm attempting to update the css within a div using its id via :
$(this.id).removeClass("myCss");
Should'nt this work ?
Your selector is wrong:
$(this).removeClass("myCss");
Or, if you want to use the id
, you'd need to concatenate it in:
$( "#" + this.id ).removeClass("myCss");
But that's really not necessary if this
references your element to begin with.
To select object by ID you should use #
prefix:
$("#" + this.id).removeClass("myCss");
Otherwise, use just:
$(this).removeClass("myCss");
No, it shouldn't :-) Just do
$(this).removeClass('myCss');
When selecting elements by "id" value, you have to include a leading "#" before the string. There's no point to doing that, however, if you've already got a reference to the DOM node.
you should do:
$(this).removeClass("myCss");
Here is the right code:
$(this).removeClass('myCss')