I have a button as follows and I want to change the class name of span on it. But the following code is not working. How can I do that?
<button id="btn_new">
<span class="ui-icon ui-icon-plus"></span>new
</button>
jquery code:
$('#btn_new').click(function({
$(this).find('span').toggleClass('ui-icon-plus ui-icon-tick');
});
also i tried this:
$('#btn_new').click(function({
$(this).find('span').removeClass('ui-icon-plus').addClass('ui-icon-tick');
});
well you can try removeClass and addClass like this
$('#btn_new').click(function({
$(this).find('span').removeClass('ui-icon-plus');
$(this).find('span').addClass('ui-icon-tick');
});