• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using data Attribute on Option Tag

 
Ranch Hand
Posts: 2025
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I get a null return when attempting to access the value of a data attribute from an option tag.

This is the html code
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are looking for the attribute on the function context (this) in the handler. Is that really where you need to be looking for it?
 
Steve Dyke
Ranch Hand
Posts: 2025
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You are looking for the attribute on the function context (this) in the handler. Is that really where you need to be looking for it?



I see what you mean. I have changed to this but get undefined now:

 
Steve Dyke
Ranch Hand
Posts: 2025
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You are looking for the attribute on the function context (this) in the handler. Is that really where you need to be looking for it?



I see what you mean. I got this to work. Thanks for the help:

 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic