Skip to main content

Bug Tracker

Side navigation

#6392 closed enhancement (wontfix)

Opened April 02, 2010 12:51PM UTC

Closed October 25, 2010 07:14AM UTC

Last modified March 14, 2012 01:53AM UTC

$('DIV#myId').attr('for') - im can't read value of "for" attribute, if i'm rename this attribute, all is work

Reported by: leadaxe Owned by:
Priority: low Milestone: 1.5
Component: manipulation Version: 1.4.2
Keywords: attr Cc: paulirish, kswedberg
Blocked by: Blocking:
Description

bug demo example:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<div for="test" id="myId"></div>

<div fortest="test" id="myId2"></div>

<script>$(function(){

alert('$("#myId").attr("for") is "'+$("#myId").attr("for")+'"');

alert('$("#myId2").attr("fortest") is "'+$("#myId2").attr("fortest")+'"');

});</script>

Attachments (1)
  • test-6392.html (0.5 KB) - added by dmethvin August 11, 2010 02:11AM UTC.
Change History (4)

Changed April 02, 2010 01:54PM UTC by miketaylr comment:1

divs don't have for attributes--only labels: http://www.w3.org/TR/REC-html40/interact/forms.html#adef-for

Changed April 02, 2010 03:45PM UTC by leadaxe comment:2

ok, but it is work for any different undeclared attributes.

Changed August 11, 2010 02:14AM UTC by dmethvin comment:3

This is because the "for" property when used in HTML is actually "htmlFor", for example in the label element. That would be true of any of the special cases in jQuery.props I suspect. XML documents don't get this special treatment so "for" would be "for" there. I'm not sure whether this is worth fixing, or just documenting.

Changed October 25, 2010 07:14AM UTC by SlexAxton comment:4

cc: → paulirish, kswedberg
milestone: 1.4.21.5
priority: → low
resolution: → wontfix
status: newclosed
type: bugenhancement

+1 for documenting.

Closing the ticket as it is not a bug, but cc'ing people who <3 documentation.