WordPress.org

Forums

Contact Form 7
[resolved] Adding an ID to the element markup (4 posts)

  1. cferdinandi
    Member
    Posted 1 year ago #

    First off, thanks for building what is hands-down the best form plugin available for WordPress.

    Is there a way to add an ID to the <form> element in the markup? I don't necessarily care if I can specificy it myself or if the ID used in the shortcode gets assigned, but it would be great to have <form id="1234" ...> in the markup.

    I'm working with a script that needs to target specific forms, and the lack of IDs is making things a tad more difficult.

    Thanks in advance!

    http://wordpress.org/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    <form> elements don't have id attributes, but their parents <div> elements do. The plugin doesn't have a feature to assign arbitrary id to <form> elem.

  3. cferdinandi
    Member
    Posted 1 year ago #

    @Takayuki - Thanks for the quick response. Is there a reason why this decision was made? IDs are valid on the <form> element, and useful for scripting purposes.

  4. cferdinandi
    Member
    Posted 1 year ago #

    I ended up using node.parentNode.id to serve the same purpose. Thanks for the quick reply, and if at some point in the future you'd like to add a way to generate an ID on the form element itself, that would be awesome!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags