Search code examples
jqueryhtmlmailmerge

Is it possible to create a custom html attr as a tag


Is it possible to add a custom attribute in this format to a html element.

<div class="example" editor:edit></div> 

( A bit like Mailchimp's merge tags)

If so, how would I go about targeting the element, preferably with jQuery.


Solution

  • MDN's HTML attribute reference implies that you should never create non-standard attributes.

    This is the very purpose of the data-* attribute, which description in the list is: Lets you attach custom attributes to an HTML element.