留言板

How to add ID to the CLASS in AUI?

sudheer kumar,修改在9 年前。

How to add ID to the CLASS in AUI?

Junior Member 帖子: 54 加入日期: 13-9-25 最近的帖子
I want to apply some css to the login portlet, i tried to add a class, but its not applying all css properties only background color is applying, so i want to make it id instead of class, How to add id in AUI?

This is my code:

AUI:

var nodeObject = A.one('.portlet-login .form');

nodeObject.addClass('sign_in_form_background');

This is my css

.form sign-in-form, .sign_in_form_background {
background: #0193b7;
margin-left: 30%;
margin-right: 30%;
padding-left:5%;
padding-right:5%;
padding-top: 50px;
}
Oliver Bayer,修改在9 年前。

RE: How to add ID to the CLASS in AUI? (答复)

Liferay Master 帖子: 894 加入日期: 09-2-18 最近的帖子
Hi Sudheer,

I'm not an AUI expert so I can only give you a debugging hint. I would first check e.g. with firebug if your css is overridden (because the background rule is applied) by some other css classes, ids etc. If that's the case you can add "!important" to your margin and padding rules to enforce that they're applied.

HTH Oli
thumbnail
Suraj Bihari,修改在9 年前。

RE: How to add ID to the CLASS in AUI? (答复)

Junior Member 帖子: 44 加入日期: 13-12-20 最近的帖子
Hi Sudheer,

Looks like your setting attributes in JS, the correct syntax for AUI is:

.attr('id', 'my-id')


For more reference please checkout this link.

HTH! :-)
Suraj