Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add and ID to an element #939

Closed
nickdgreen opened this issue Nov 24, 2016 · 17 comments
Closed

Feature Request: Add and ID to an element #939

nickdgreen opened this issue Nov 24, 2016 · 17 comments
Labels
request/enhancement Indicates an Enhancement Request for an existing feature.
Milestone

Comments

@nickdgreen
Copy link

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

@arielk arielk added the request/enhancement Indicates an Enhancement Request for an existing feature. label Nov 27, 2016
@arielk
Copy link
Member

arielk commented Nov 27, 2016

Why not using by CSS Classes?

@peepshow
Copy link

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.

@arielk
Copy link
Member

arielk commented Nov 28, 2016

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!

@pingram3541
Copy link
Contributor

pingram3541 commented Dec 24, 2016

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?

@drawcard
Copy link
Contributor

drawcard commented Dec 27, 2016

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 :)

@pingram3541
Copy link
Contributor

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?

@nickdgreen
Copy link
Author

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.

@pingram3541
Copy link
Contributor

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.

@arielk
Copy link
Member

arielk commented Jan 3, 2017

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

@pingram3541
Copy link
Contributor

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

@drawcard
Copy link
Contributor

drawcard commented Jan 3, 2017

Nice one @arielk - thanks for looking into it!

@arielk
Copy link
Member

arielk commented Jan 11, 2017

Things To Do:

@collindavis
Copy link

collindavis commented Jan 12, 2017

@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.

@arielk
Copy link
Member

arielk commented Jan 30, 2017

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

@arielk arielk modified the milestones: 1.1.0, 1.2.0 Jan 30, 2017
@collindavis
Copy link

collindavis commented Jan 30, 2017 via email

@pingram3541
Copy link
Contributor

Thank you =)

@magnums
Copy link

magnums commented Sep 17, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request/enhancement Indicates an Enhancement Request for an existing feature.
Projects
None yet
Development

No branches or pull requests

8 participants