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

  • Home
  • SEARCH
  • 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 8847323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:09:53+00:00 2026-06-14T12:09:53+00:00

I have a loop which generates lot of input text fields with jquery. Now

  • 0

I have a loop which generates lot of input text fields with jquery. Now i want to fire stopPropagation method when someone clicks on those input tags. I am in a notion that this method works like this:

event.stopPropagation()

But problem is that i want to fire this method on onClick attribute of the input tag. Like this:

$(handler).html('<input type="text" value="'+text+'" style="width:280px;" onClick=stopPropagation(); />');

And this won’t work for obvious reasons. I need to get the event object for this click. Whats the smarter way?

  • 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-14T12:09:54+00:00Added an answer on June 14, 2026 at 12:09 pm

    Its easy, just add “event” key word to your onClick call, like so:

    $(handler).html('<input type="text" value="'+text+'" style="width:280px;" 
        onClick=stopPropagation(event); />');
    

    Then in your function:

    function stopPropagation(event) { /* do work */ }
    

    or you can do it the jQuery way:

    $('input').on("click", function(event) { /* do work */ });
    

    keep in mind, on your inline functions, just like the word this, event is a key word that tells the js your function should be getting an event argument

    Finally you could just change the add all together:

    var newInp = $("<input />").width(280).text(text);
    $(handler).append(newInp);
    newInp.on("click", function(e) { /* e is your event */ });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop in razor which generates a template a number of times.
In MATLAB, I have a for loop which has a lot of interations to
I have the following loop which generates a little snippet of html: for (var
I have the Loop which generates tasks. Code: Task task = null; foreach (Entity
I have this loop which generates a vector Diff. How do I place the
I have php code which executes a loop, inside which it generates the following:
I have a loop which generates tables according to a database content. In other
I have a for loop which generates few 'a' tag buttons and few divisions.
I have the following method which generates a random number: int random_number() //Random number
I have a loop which basically calls this every few seconds (after the timeout):

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.