these are extract of my code
<button>Hook It!</button>
and a bit of JQuery
$("ul li .tag_detail button").on('click', function() {
console.log($(this).html());
if ($(this).html() == 'Hook It!') {
$(this).html('Unhook!');
}
if ($(this).html() == 'Unhook!') {
$(this).html('Hook It!');
}
});
Now, as you can see i want a toggling effect, i.e. when i click on button it should toggle between Hook It! and Unhook!.
The problem lies here
if($(this).html() == 'Hook It!')
here this condition never passes while console log prints Hook It!
console.log($(this).html());