Bug Tracker

Opened 11 years ago

Closed 11 years ago

#5603 closed bug (invalid)

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@…
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.

Change History (1)

comment:1 Changed 11 years ago by john

Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.