Skip to main content

Using and Understanding HTML Element Attributes

  • Chapter
  • First Online:
Beyond jQuery
  • 1318 Accesses

Abstract

Here in chapter five, prepare yourself for a full-scale, in-depth, no-holds-barred discussion on everything related to element attributes. Everything you learned in Chapter 4 will prove to be useful as you apply this knowledge during your journey through attributes. I’ll make sure you have a proper understanding of attributes, how they came about and became part of HTML, and how they fit into the web API. Additionally, you’ll learn how to use attributes to locate DOM elements. Although this is covered a bit in Chapter 4, you’ll find that the coverage here is much more comprehensive. And finally, I’ll dive deeper into attributes and demonstrate how you can read, add, and update them on any DOM element. Special sections on data- and class attributes will be included as well.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 16.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-104682815

  2. 2.

    www.w3.org/TR/html5/forms.html#the-form-element

  3. 3.

    www.w3.org/TR/html5/forms.html#the-input-element

  4. 4.

    www.w3.org/MarkUp/html-spec/html-spec_toc.html

  5. 5.

    www.w3.org/MarkUp/html3/input.html

  6. 6.

    www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html

  7. 7.

    www.w3.org/TR/html5/forms.html#constraints

  8. 8.

    www.w3.org/History/19921103-hypertext/hypertext/WWW/MarkUp/Tags.html

  9. 9.

    www.w3.org/TR/html5/text-level-semantics.html#the-a-element

  10. 10.

    www.w3.org/TR/html5/syntax.html#attributes-0

  11. 11.

    www.w3.org/TR/html5/single-page.html#boolean-attributes

  12. 12.

    www.w3.org/TR/html51/editing.html#the-hidden-attribute

  13. 13.

    www.w3.org/TR/html5/syntax.html#named-character-references

  14. 14.

    http://blog.jquery.com/2011/05/03/jquery-16-released/

  15. 15.

    www.w3.org/TR/html5/grouping-content.html#the-div-element

  16. 16.

    www.w3.org/TR/html51/semantics.html#the-a-element

  17. 17.

    https://url.spec.whatwg.org/#urlutils

  18. 18.

    https://url.spec.whatwg.org

  19. 19.

    www.ecma-international.org/ecma-262/6.0/#sec-keywords

  20. 20.

    www.w3.org/TR/CSS2/selector.html#attribute-selectors

  21. 21.

    www.w3.org/TR/css3-selectors/#attribute-substrings

  22. 22.

    https://dom.spec.whatwg.org/#dom-element-classlist

  23. 23.

    www.w3.org/TR/dom/#dom-element-classlist

  24. 24.

    https://dom.spec.whatwg.org/#domtokenlist

  25. 25.

    https://dom.spec.whatwg.org/#dom-domtokenlist-contains

  26. 26.

    http://jsperf.com/classlist-contains-vs-hasclass

  27. 27.

    http://jsperf.com/jquery-addclass-removeclass-vs-dom-classlist

  28. 28.

    www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-%2A-attributes

  29. 29.

    www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-666EE0F9

  30. 30.

    www.w3.org/TR/DOM-Level-2-Core/core.html#ID-666EE0F9

  31. 31.

    http://jsperf.com/hasattribute-vs-jquery-is

  32. 32.

    www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-setAttribute

  33. 33.

    www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-removeAttribute

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Ray Nicholus

About this chapter

Cite this chapter

Nicholus, R. (2016). Using and Understanding HTML Element Attributes. In: Beyond jQuery. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2235-5_5

Download citation

Publish with us

Policies and ethics