Skip to main content

Bug Tracker

Side navigation

#5603 closed bug (invalid)

Opened December 05, 2009 11:58AM UTC

Closed December 10, 2009 05:49AM UTC

Troubles on using #myDiv[name=value] with multiple similar ids on IE, FF and Safari

Reported by: M'sieur Toph' Owned by:
Priority: minor Milestone: 1.4
Component: unfiled Version: 1.4a1
Keywords: Cc: chr.pot@gmail.com
Blocked by: Blocking:
Description

Hi

(I'm french, so please excuse my broken english).

I'm experiencing trouble on using the selector [attribute=value] with some navigators :

IE 6 (i'm dont have license for higher), Safari (3.2.1) and FireFox (3.0.15)

Imagine the following html code :

<html>

<head>

<script src="http://code.jquery.com/jquery-latest.js"></script>

<script>

$(document).ready(function(){

$("div[id='myDiv'][name='1']").html("Test");

$("#myDiv[name='1']").html("Test again");

});

</script>

</head>

<body>

<div id='myDiv' name='0'></div>

<div id='myDiv' name='1'></div>

</body>

</html>

I'm using the name attribute to store information about the divs without changing the id (and the associated CSS style used)

But, if you try to use the following js code on the not-first element, it will not return the attending value :

The first line will correctly fill the div 'myDiv' with 'Test'.

But the second one will not replacing the text by 'Test again' on FF, IE and Safari. It will work on Chrome and Opera, however.

Maybe, i'm doing something wrong but all my tests returned the same result.

Attachments (0)
Change History (1)

Changed December 10, 2009 05:49AM UTC by john comment:1

resolution: → invalid
status: newclosed

The name attribute is invalid on a div element - maybe you should use something else, like a class?