user3422998
user3422998

Reputation: 105

Change style using JS

I have a CSS code:

.ui-dialog-buttonset .on{
        color: black;
        border-radius: 7px;

    }

And i want to set display = none for this using jquery:

$('#ui-dialog-buttonset .on').css('display', 'none');

It is not woring. What am I doing wrong ? Appreciate your help.

Upvotes: 0

Views: 62

Answers (3)

Silwest
Silwest

Reputation: 1620

.ui-dialog-buttonset - this is class #ui-dialog-buttonset - this is ID

You are changing css of different item, which probably doesn't exists on your page.

Upvotes: 0

Fran Herrera
Fran Herrera

Reputation: 58

You're telling jQuery to search for an element with id ui-dialog-buttonset because you used #. To select a class you must start with the "." like in:

$('.ui-dialog-buttonset .on').css('display', 'none');

Upvotes: 0

George
George

Reputation: 36784

ui-dialog-buttonset is a class, not an id. So select it using a period, not a hash:

$('.ui-dialog-buttonset .on').css('display', 'none');

Upvotes: 2

Related Questions