Change Anchor Text On Click With...? Jquery Maybe?
This is an anchor / toggle which opens and closes a drawer like navigation. I want the icon / text to change once it's clicked. But my jQuery is so basic i'm struggling with this a
Solution 1:
This should do .
$('.btn.btn-navbar').on('click', function(e) {
e.preventDefault();
$(this).text(function(i,v) {
return v === 'Show' ? 'Hide' : 'Show';
});
});
Try this approach
var flag = true;
$('.btn.btn-navbar').on('click', function(e) {
e.preventDefault();
$(this).html(function(i,v) {
return flag === true ? 'ת' : '';
});
flag = !flag;
});
Post a Comment for "Change Anchor Text On Click With...? Jquery Maybe?"