• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery Cannot Find DOM Element

 
Steve Dyke
Ranch Hand
Posts: 1643
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand why $('#msgProgress').val() returns undefined

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because spans don't have values.

Your title is way off -- jQuery is finding the element just fine. Then you are asking it to return something that does not exist. No surprise that you get undefined.
 
Steve Dyke
Ranch Hand
Posts: 1643
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Because spans don't have values.

Your title is way off -- jQuery is finding the element just fine. Then you are asking it to return something that does not exist. No surprise that you get undefined.


The reason I was testing for value is because I have tried to attach a click event to the span id. I could not get it to fire so I just trying to use something to see if the dom recognized the id or not.

Anyway I cannot get the following to fire.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic