Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6004171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:13:32+00:00 2026-05-23T01:13:32+00:00

This problem occurs on Safari. I don’t get the problem on IE (which is

  • 0

This problem occurs on Safari. I don’t get the problem on IE (which is a first).

I have a sortable:

<ul id='srt'>
    <li><a class='url' href='http://www.test.com'>test</a></li>
    <li><a class='url' href='http://www.test1com'>test1</a></li>
    <li><a class='url' href='http://www.test2com'>test2</a></li>
</ul>

and the following script:

$(document).ready( function() {
    $("#srt").sortable();

    $(".url").click( test );
});

function test() {
    $(this).text( "done" );
    return false;
}>

Clicking a link will change the text to ‘done’, but dragging it will also change the text to ‘done’. But I don’t want to click on the link at the end of a sort.

Like I said: IE is running the function like it should, it sorts the link and doesn’t trigger the bound click-function, but Safari does trigger the click…

How can I prevent this from happening?

Edit: I created a jFiddle for this so you can try it out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:13:32+00:00Added an answer on May 23, 2026 at 1:13 am

    Actually I’m having the same problem in my current project, and i really don’t have a clue since at the beginning was working properly, but after some change in code it stopped to work. the problem is that i made a lot of changes and i can’t imagine which create the problem

    Hwr in you case is simpler luckily. You should never pass event handler like this in jquery. Use this syntax:

    $(".url").click( function(){
        test();
    });
    

    This works!

    EDIT:
    My apologies, it still trigger the handler when sorting. Two are the solutions!

    The best one:

    $("#srt").sortable({ helper: 'clone' });
    $(".url").click( function() { $(this).text( "done" ); } );
    

    Using helper: ‘clone’ option avoid the plugin to run the handlers on the elements. (note that i included the test() body into the anonymous function, otherwise you would not be able to use “this”)

    Uglier one and that cause problems with event bubbling:

    $("#srt").sortable();
    
    $(".url").live('click', function() { $(this).text( "done" ); } );
    

    This is just for teaching reasons! since the live() events are not in the elements itself, they don’t get triggered by sortable!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem occurs in both NHibernate 2 and 3. I have a Class A
I test the code in IE7, FF, Chrome, Safari and this problem occurs in
This problem occurs when I try to hide a file in my directory with
This problem has been kicking my butt for a few days now. I have
This problem has bugged me so many times and i have now decided to
This problem is happening for me on IE8 and Chrome which makes me think
This is more of an intriguing problem than anything else since I have managed
I most likely have the same problem as in this question: Weird Chrome prototype/jQuery
I think that this problem occurs often on a web application development. But I'll
I'm having a socket problem. This problem occurs when I'm running the server and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.