Bug Tracker

Modify

Ticket #9545 (closed bug: worksforme)

Opened 2 years ago

Last modified 2 years ago

fail to read attribute in A dom element

Reported by: admin@… Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

<a href="" id="id" value="aaa">aa</a>

below not reponse $("#id").attr("value") $("#id").prop("value")

Change History

comment:1 Changed 2 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

Seems okay to me. The attribute is defined but there is no property named value on a link.

 http://jsfiddle.net/uK3kr/

comment:2 Changed 2 years ago by timmywil

  • Priority changed from undecided to low
  • Component changed from unfiled to attributes

comment:3 follow-up: ↓ 5 Changed 2 years ago by anonymous

hihi this bug only at 1.6.1 below jquery 1.5.2 all is work. i test your url but that jquery version is 1.5....

comment:4 Changed 2 years ago by dmethvin

I tested both 1.6 and (edge) again using the fiddle; both seem to work fine. To re-emphasize, it is correct that the *attribute* exists and is retrieved via .attr() but the *property* does not which is why .prop() returns undefined.

comment:5 in reply to: ↑ 3 Changed 2 years ago by peizguo

Replying to anonymous:

hihi this bug only at 1.6.1 below jquery 1.5.2 all is work. i test your url but that jquery version is 1.5....

Yes, it occurs at 1.6.1 caused by the attrHooks.value. Please visit  http://jsfiddle.net/w9tcq/3/ and see the result at console

comment:6 Changed 2 years ago by timmywil

value is not valid on a cite tag either, but yes. This is intended behavior for value in order to make retrieving value backwards compatible, as you will notice 1.5.2 does the same thing:  http://jsfiddle.net/timmywil/w9tcq/4/

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.