I am making a responsive website. For the mobile version, I am using jQuery mobile, which adds lots of classes to my HTML. I don’t want these classes for the Desktop version.
All the jQuery mobile classes are prefixed with “ui”. Although I can use .removeClass(''), I would have to use a separate .removeClass('') deceleration for each class and for each HTML element.
How can I use a wildcard approach to remove all classes that start with ui, regardless of which element they are on?
I found a plugin called jQuery alterClass, which is supposed to do this, but I can’t seem to get it to work. I’ve followed the instructions exactly, but it wont remove the classes. I have set up a JSFiddle here.
In your fiddle,
Your anchor tag has id:
<a id="#foo"You are referring it it in JQuery as
$('#foo').That refers to an element with
id = foo.(Fiddle)