Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:15:44+00:00 2026-05-26T14:15:44+00:00

I create a plugin, and I like to have some extra attributes in my

  • 0

I create a plugin, and I like to have some extra attributes in my HTML elements. I know that if I create my own custom attributes the HTML document will not valid, but this is not the problem. I just wondering, in that case it will be posible to access that atributes with jQuery ?

ie:

<div id="c" my-custom-attr="myValue" data-my-custom-attr="another-value">
    Content here
</div>

<script type="text/javascript">
    $att1 = $('#c').attr('my-custom-attr');
    $att2 = $('#c').attr('data-my-custom-attr');
</script>

Will create any problem with any browser the above code ? 😕

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:15:44+00:00Added an answer on May 26, 2026 at 2:15 pm

    While no one can say it will work in all browsers; your code should not cause any problems in the major modern browsers. I would suggest using the data-* HTML5 naming convention as you’ve done in your second example.

    As a side note; in your second example, you can access the attribute in two ways using jQuery 1.4.3+

    <div id="c" data-my-custom-attr="another-value">
        Content here
    </div>
    
    <script type="text/javascript">
        // Both produce the same output //
        console.log($('#c').attr('data-my-custom-attr'));
        console.log($('#c').data('my-custom-attr'));
    </script>
    

    I hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a Visual Studio like plugin for Eclipse that will allow me create
Typically I create a plugin when I have a module that I know I'm
I would like to create wordpress plugin that will display quote of the day.
I have some data analysis code that processes an input file and outputs HTML
I have some old C# plugin code that was implemented strictly with Reflection. In
Django-CMS custom plugins and navigation extenders allow to create any content HTML in some
I would like to get some advice. I am developing a system that will
How do we create a search plugin for Safari? Like this post
I want to create a plugin 'myPlugin' which simply add some text to a
I'm trying to create my own plugin. But I'm having trouble getting things right.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.