elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.

Home Page:https://elementor.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Add and ID to an element

nickdgreen opened this issue · comments

The ability to add an ID to an element so that it can be individually targeted with #styleStyle from add on CSS

Why not using by CSS Classes?

commented

ID's are sometimes a required if you're trying to combine with another plugin, JS or WP. Also ID's are helpful if you want to add anchor tags. ID's are generally considered better for performance when referenced in JS too as they are unique selectors.

We know it. But we're really trying to find a way to do it in a way that will not create conflicts with duplicate ID.

Thanks for your feedback!

Duplicate ID's are likely not going to hurt anything (outside of js plugins or absolute positioning) as most browsers ignore that technically there is supposed to only be one by spec.

Many other builders already provide the ability to add id's without all hell breaking loose and it's not a complex thing to add in so maybe reconsider this request again. ID's have one very important thing for me, hierarchical superiority which means writing less of these:

!important

The spec of ID attributes being unique is not really that big of a problem is it?

I just discovered how badly I need this feature, trying to implement vivus.js on some SVG's in my layout. Vivus explicitly uses ID's to identify SVG elements, in order to trigger the animations / callbacks.

Perhaps a simple validator could be written that continuously detects all custom ID's on the page, and warns the user if there's a conflict. Or maybe the ID customisation feature is a toggle for advanced users on the settings page.

I would also appreciate any reconsideration on this feature request :)

A simple js object could be used with validation to ensure no duplicates are ever entered.

Would love an example on how to add a custom control to a section. Inspecting the code it looks like it was designed to only allow for customizing or adding our own widgets but sections and columns are private and protected by design. No?

I don't see the need for validation or duplicate checking the website designer/builder has to take some responsibility for the control of IDs and most designers/builders will use recognisable IDs pageOneSectionOne, pageOneSectionTwo etc. to me it's a gap in the product that can be filled without over thinking it.

I agree, duplicate id's are likely not going to cause any problems for anyone w/ exception of an occasional script error or broken anchor but the suggestion was based off the data already being present and a very low scope to push all id's to an array to check against.

Again, would love to see examples of how to add out own controls to sections and columns, not just extend existing ones.

Thanks to each of you on the comments and ideas, we'll add this option soon.

Thanks @arialk this will be most helpful and very much appreciated!

Nice one @arielk - thanks for looking into it!

Things To Do:

  • Move all element ID's in editor mode to classes
  • Add CSS ID control in Advanced Tab in element base (#939)

@arielk will custom IDs be supported for individual Tab items as well? This would be most helpful for auto-loading specific tabs on page load or via anchor tag links.

@collindavis Unfortunately we can not add this option, because we add auto item ID for each tab

Thank you =)

it's work for me. so try this.

  1. adding the Heading widget or Text editor widget.
  2. put html code like this: <p id="your-id"></p>
  3. then you able to using jquery add or remove the value in that elements.
    Hope this help.