Bug Tracker

Modify

Ticket #5963 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

Attribute Selector Error in Internet Explorer 7/8

Reported by: Executter Owned by:
Priority: major Milestone: 1.4.2
Component: unfiled Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

The following selector works in every Browser, except IE8 with IE7-Compatibility-Mode:

$("a[href='#test']").click(function(){

alert("blah"); return false;

});

The link in source-code looks like this: <a href="#test">Test/<a>

It produce no errors, but IE is ignoring this event completely. Instead showing the alert-box, IE is opening the link with the parameter "#test".

This selector has been successfully tested in: Firefox 3.6, Opera 9.64 and Chrome 3.0.195.38, but in IE8 it don't work.

To bypass this error I've given the link an Id and used the Id in the selector.

The strange fact is, that another selector with the same syntax works: $("a[href='#produkte']").click(...)

I've attached the whole script to this ticket. Thanks for your attension.

Attachments

produkte.jquery.js Download (5.0 KB) - added by Executter 4 years ago.
Whole Script

Change History

Changed 4 years ago by Executter

Whole Script

comment:1 Changed 4 years ago by dmethvin

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

Unfortunately, IE "normalizes" the href attribute to the full url ( http://yoursite.com/page.htm#test). That is why your attribute test does not match. Try a selector like [href$='#test'] instead.

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.