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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:15:21+00:00 2026-06-11T19:15:21+00:00

While on jquery click event got value for first time but second time it

  • 0

While on jquery click event got value for first time but second time it comes to empty

JS:

$(".topPanel").live('click', (function(e) {

    form = $(e.target).attr("name");
    content = $("." + form);    
    $(".show_panel1").html("");
    $(".show_panel1").html(content);
    $(".show_panel1").show();

}));

HTML:

 <div class="topPanel"  >
   <span id="5" name="panther" style="background: #990000;" class="span_1">  
                   Panther</span>
   <span id="6" name="lion" style="background: #009900;" class="span_1">
                   Lion</span>         
 </div>

 <div class="show_panel1" >
     <label class="label">welcome</label>
 </div>
 <div class="tiger" >
     <label  class="label">i am panther</label>
 </div>
 <div class="lion" >
     <label  class="label">i am lion</label>
 </div>​

CSS

.label
{
    font-family: Verdana; 
    font-size: medium;
    font-weight:lighter; 
    color: #FF990000;
    float:inherit;
    margin:10mm;
}

.topPanel
{
    float: left; 
    color:#000000;
    background: none repeat scroll 0% 0% orange; 
    width: 1280px;
    margin: 10px 5px 5px 10px;
}

.span_1
{
   float: left; 
    height: 40px; 
    width:5%; 
    padding:20px;
    margin: 0px 5px 0px 0px;
}

​

  • 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-11T19:15:23+00:00Added an answer on June 11, 2026 at 7:15 pm

    These two lines don’t make sense:

    content = $("." + form);    
    $(".show_panel1").html(content);
    

    content is a jQuery object. You can’t put a jQuery object into the html of another object. Perhaps you meant:

    var content = $("." + form);    
    $(".show_panel1").html(content.html());
    

    This would get the HTML from the content object and put it into .show_panel1. Note, I also declared the content variable to be a local variable rather than allowing it to be an implicit global variable which is bad.


    Please show us the HTML that contains class="form" so we can see what you’re actually trying to do here.

    Also, .live() has been deprecated (you should no longer use it). Replace it with .on() (for recent versions of jQuery) or .delegate() (for older versions of jQuery).

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

Sidebar

Related Questions

I have always used the mouseover event, but while reading the jQuery documentation I
i got 'JQuery' is undefined error while browsing the page in IE 6 but
I need to make some part of text bold while displaying in jquery: $(':checked').each(function()
I want to setup a click event trigger in jQuery for certain anchor tags.
When using .animate() while changing top / left , the click event does not
I have a div containing a href. The div has a jQuery live click
I am using jquery mobile alpha 4. I simply bind a click event on
Using jQuery, I have attached a click event handler to some li HTML elements.
I have a function attached to the div #Browse 's click event that toggles
I have an anchor tag that has a jQuery click event linked to it.

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.