SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    click event in IE7 not working

    I have a button that is a facebook button that is coded as:

    <div class="fbshare1"><a class="login-button"><span>Like</span></a></div>

    In a js file, I reference it by

    $('.fbshare1 .login-button span').live('click', function(e) {

    It works fine in Firefox and IE8 but IE7 doesn't recognize the click. Is there a reason for that or is some other kind of problem?

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Why not use??

    Code JavaScript:
    $('.fbshare1 a.login-button').live('click', function(e) {

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I can do that. Is there any reason what I had wouldn't work with IE7 and can I assume safely that what you have sent will absolutely work with IE7? It's not my computer and I'm trying to isolate the problem to IE7 or something on the computer.

    Like I said, it works fine with IE8 and FF on other computers.

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    My guess is that IE 7 can create an event handler on a span element there for nothing happens, by default you should always try to use events on a and input elements as they have been cross compatibility between browsers.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •