Reputation: 153
I have a problem with jQuery Mobile. I have a hideOnInit
class on a page.
like this:
<div data-role='page' id='hi' class='hideOnInit'>
on a button click i want to remove the class='hideOnInit'
.
I have tried
$('#idOfPage').removeClass('hideOnInit');
and without the . before hideOnInit
, but it isn't working.
could anyone help?
thanks in advance.
Upvotes: 0
Views: 86
Reputation: 148178
You do not have to give .
in removeClass
with class name. Remove dot from class in parameter passed to removeClass.
You have div with id = hi
but you are removing class from id = idOfPage
Change
$('#idOfPage').removeClass('.hideOnInit');
To
$('#idOfPage').removeClass('hideOnInit');
Change
<div data-role='page' id='hi' class='hideOnInit'>
To
<div data-role='page' id='idOfPage' class='hideOnInit'>
Upvotes: 2
Reputation: 2653
ClassName should be used inside the removeClass method i.e without . (.hideOnInit)
$('#idOfPage').removeClass('hideOnInit');
Thanks
Upvotes: 1