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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:06:21+00:00 2026-05-12T11:06:21+00:00

After inserting new html to DOM,I need to add some listeners to it. But

  • 0

After inserting new html to DOM,I need to add some listeners to it.

But the new elements are not available at once.

My code:

$('#loader').clone().removeAttr('id').load("Views/chatBox.html").appendTo('body');
$('#chat')
    .focus(function() {
        $(this).addClass('jV');
    })
    .blur(function() {
        $('#chat').removeClass('jV');
    });

Which is not working .

Using live() still not working:

$('#chat').live('focus',function() {
    $('#chat').addClass('jV');
})
.live('blur',function() {
    $('#chat').removeClass('jV');
});
  • 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-12T11:06:21+00:00Added an answer on May 12, 2026 at 11:06 am

    If #chat is in the chatBox.html that you are loading then you can take advantage of the callback that load has:

    $('#loader').clone().removeAttr('id').load("Views/chatBox.html",function(){
        $('#chat').focus(function() {
            $(this).addClass('jV');
        })
        .blur(function() {
            $('#chat').removeClass('jV');
        });
    }).appendTo('body');
    

    http://docs.jquery.com/Ajax/load#urldatacallback

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

Sidebar

Related Questions

I need to go to Edit Mode after inserting new item. OnItemInserted Metod: protected
After inheriting some Zend Framework code it didn't work, after lots of fiddling I've
I have a table with an auto-incrementing ID. After inserting a new row, I
I have problem with updating my datagridview after inserting new data to table. It
I'm having a trouble with getting the id after inserting a new Record using
Short version: After inserting a select element with options into the DOM with an
need to do trigger after Inserting on a table called jos_jquarks_quizzes, I need to
public class Convert{ /* the algorithm works as follows after inserting all elements of
Keep getting this error after inserting a subdatasheet into a query and trying to
DetailsView1.DefaultMode = DetailsViewMode.Insert; After inserting how can i Preview Data before Submitting/Inserting data in

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.