eozzy
eozzy

Reputation: 68650

Button has no text

$(function() {
    $('#enable_disable_btn').unbind('click');
    if ('{{$userStatus()}}' == 'Active') {
        $('#enable_disable_btn').html("Disable User");
        $('#enable_disable_btn').click(DisableUser);
    } else {
        $('#enable_disable_btn').html("Enable User");
        $('#enable_disable_btn').click(EnableUser);
    }
});

HTML:

<a href="#" id="enable_disable_btn"></a>

The button appears blank, no text. I wonder whats wrong here.

Upvotes: 0

Views: 72

Answers (2)

TomekBrzyn
TomekBrzyn

Reputation: 1

If it is a input type="button" or "submit" then you must use jQuery('#enable_disable_btn').val('Disable user')

Upvotes: -1

AKX
AKX

Reputation: 168883

If it's a

<input type="submit">

or similar, you'll have to use

$(...).val("Enable User");

as it's the value attribute that is displayed on the button.

Upvotes: 2

Related Questions