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 8298293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:43:10+00:00 2026-06-08T15:43:10+00:00

I have a jQuery autocomplete set up, for which I have a few special

  • 0

I have a jQuery autocomplete set up, for which I have a few special requirements.

  • This is an autocomplete of “user profiles”, where each autocomplete entry is rendered by the _renderItem as follows:

Username: _firstname_lastname_


Phone number: _clickable_phone_number_


This part works fine.

  • Upon selecting, immediately navigate to a different page. I’ve achieved this using a custom select which uses window.replace to go to a different page (that person’s profile)

This works fine as well.

  • Finally, the “_clickable_phone_number_” link should call another javascript snippet. Or a simply hyperlink

The last part is where I’m having a problem. Since I immediately navigate to a different page upon select, I could not figure out how to “prevent” this action.

I am able to add a .live to the _clickable_phone_number_ and run some JS, but I’m not able to stop navigation to the profile page.

I hope I’m clear. If not, I can explain further.

Can anyone help me on how to achieve this? Basically, how do I hyperlink from within the custom rendered HTML, despite having a custom select() that navigates to a different page.

EDIT: Since code snippets might make it clear, here’s what I mean:

My jQuery autocomplete has a select, like so:

$('#input').autocomplete({ source: users, minLength: 3,
 select: function(event, ui) 
{ window.location.replace("/profile.asp?id=" + ui.item.value); }

}).data("autocomplete")._renderItem = function (ul, item) { .. }

HTML of each autocomplete rendered element:

<div class=".ui-menu">
<div class="name">FirstName LastName</div>
<div class="phone">12345</div>
</div>

I have the live event set up like so:

$('.phone').live("click", function() { callPhone($(this).html()); return false; }

  • 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-06-08T15:43:13+00:00Added an answer on June 8, 2026 at 3:43 pm

    have you tried using http://api.jquery.com/event.stopPropagation/

    You’ll have to change up your code a bit, wire up your phone links in the open event instead of using live.

    $('#input').autocomplete({ 
         source: users, 
         minLength: 3,
         select: function(event, ui){ 
             window.location.replace("/profile.asp?id=" + ui.item.value); 
         },
         open: function(event, ui){
              $('.phone').click(function(e) { 
                  e.stopPropagation();
                  callPhone($(this).html()); 
                  return false; 
               });
         }
     }).data("autocomplete")._renderItem = function (ul, item) { .. }
    

    The reason you can’t use .live anymore is because .live events arn’t fired until they have bubbled all the way up to the document, so you can’t stop anything.

    I haven’t tested this, but it should work.

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

Sidebar

Related Questions

I am trying to set up jQuery autocomplete in Rails 3.2.0. I have it
I'm using Jorn Zaefferer's Autocomplete query plugin, http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ I have options set so it
I have set up JQuery UI autocomplete according to the docs and it works
I have seen this post here: jQuery UI autocomplete with item and id but
I have an input box for which I am using the Jquery autocomplete function.
I have two jQuery UI Autocomplete widgets set up. With the first autocomplete, the
I have a jQuery autocomplete entry that I want to make look more like
I have used the jquery-ui to autocomplete an input box and set a hidden
I'm running a Rails 3 app, where I have a jQuery autocomplete box, which
I get this JS error: jquery-1.5.1.min.js:16Uncaught TypeError: Cannot set property '_renderItem' of undefined d.d.extend._Deferred.f.resolveWithjquery-1.5.1.min.js:16

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.