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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:57:47+00:00 2026-05-26T13:57:47+00:00

This question has been asked/answered (mostly) before, BUT I’ve tried three things to stop

  • 0

This question has been asked/answered (mostly) before, BUT I’ve tried three things to stop the event from bubbling but nothing has worked:

return false;
e.stopPropagation();
e.preventDefault();  

(return false should take care of the other two, correct?)

Here’s the html:

<div class="tags-holder">
    <input type="text" class="addField" id="addField_<%= visit.id %>"  placeholder="add a new tag">
</div>

And the JS (UPDATE CLEANED UP):

    $('.addField').show().keyup(function(event){
  event.preventDefault();
  
      if(event.keyCode == 13 || event.keyCode==9) {
    ProfilePage.createTag( this, 'nada', 'addField')
        $(this).hide().val('');

        return false;       
   }

});

I left the redundant stoppers in there but really shouldn’t return false simply kill the bubbling? (using Chrome).

Clue? keyCode=13 is "Enter"

  • 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-26T13:57:48+00:00Added an answer on May 26, 2026 at 1:57 pm

    Wow. Your help was great and helped me think it through.

    BUT the solution feels a bit like a cop-out; effective, but the condition should never be there in the first place.

    Here it is, which I found in the comments from here:
    http://yuji.wordpress.com/2010/02/22/jquery-click-event-fires-twice/

        $('.plus').unbind('click').bind('click',function(e){    
    console.log('clicked')
        var id=$(this).attr('plus_id');
        var field=$('<input type="text">').attr({'placeholder':'add a new tag','id': 'addField_' + id, 'visit_id':id});
        field.focus();
        field.show().keydown(function(event){
            event.stopImmediatePropagation();
            if(event.keyCode == 13 || event.keyCode==9) {
                console.log(event)
                ProfilePage.createTag( field, 'nada', 'addField')
                field.hide().val('');
                return false;       
            }
        }).click(function(e){
            return false;
        })
        ;
    $(this).append(field);
    return false;       
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this question has been asked before , but not answered in great detail.
I know this question has been asked and answered before, but none of the
This question has been asked before, but the answered ones I could find were
This question has been asked before but never really answered (at least the way
I know this question has been asked and answered before. But when I try
This question has been asked before ( link ) but I have slightly different
Maybe this question has been asked many times before, but I never found a
I know this question has been asked before, but I ran into a problem.
I know this question has been asked a bit before. But looking around I
Edit: While this question has been asked and answered before ( 1 ), (

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.