Optimize
4.7K members online now
4.7K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me
star_border
Reply

Changing element class

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Hello,

 

I would like to change my element's class.

 

It would be great adding attribute, key and value.

 

Is there any way to do it?

 

Thanks,

 

D.

1 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by topic author Doruk K
July

Changing element class

Google Employee
# 2
Google Employee

Hi Doruk

 

Yes, you may use the "Change attribute" menu option, available in the CSS selection dialog (rectangle next to the hierarchy bar).

 

There you can add a new attribute change where you can specify explicitly the CSS selector, the attribute name and attribute value.

 

If your element already has a class list value and you want to add a new class, you may need instead to add a small javascript change for your element,  where you would append your new class with js code. Still use the same CSS selector and pick the "after opening tag" option for best performance.

Changing element class

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

Hello Dimitri,

 

Thank you for your reply and yes, I learn how to do that now.

 

Thanks,

 

D.