The Problem

On a Sharepoint page, I am using jQuery to render a link using attr(‘onclick’,'somejavascriptcodehere’), and that link works in Firefox but not in IE.

The Solution

Use $(‘a#theid’).click() instead of $(‘a#theid’).attr(‘onclick’,'javascript:somejavascriptcodehere’).

The Possible Cause

IE can handle other tag attributes added or updated by jQuery, but just could not immediately add an event handler to an element.

  • Digg
  • del.icio.us
  • StumbleUpon
  • Sphinn
  • Facebook
  • Mixx
  • Google Bookmarks
  • Haohao
  • LinkedIn
  • Live
  • MyShare
  • MySpace
  • Reddit
  • Technorati
  • TwitThis

Related posts:

  1. setInterval and Firefox
  2. adding link icon based on file type: pure css or css+jQuery
  3. Image Tag and a Layout Problem in IE7
  4. Make Documents Open in a New Window from a List View WebPart in Sharepoint
  5. Implementing a XML-based Search

Tags: , , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">