I have created a style
.someRedStuff
{
background:red !important;
}
I want to change the color of the star icon to red when the button is clicked
<a data-role="button" data-iconpos= "notext" data-icon="star" id="custom-li-3" onclick="changeColor()"></a>
I tried this code but it does not seem to be doing the trick..
function changeColor()
{
$('#custom - li - 3').removeClass('ui-icon-star').addClass('someRedStuff');
}
How do I change the color of the star icon on click?
Your element selector has spaces it.
Removes the spaces in the selector to match the id declared for the element.