jquery - Cannot Display paragraph preview in pop-up window -


i have problem displaying text

tag pop-up, experiencing reference errors, can refer p tag until show p tag using .click function, need taking displayed p tag after click function , outputting hover pop-up function here code.

    $('.article h1 a').click(function(event) {     event.preventdefault();     $(this.parentnode).next('p').fadetoggle(1000);      $(this.parentnode).next('p').hover(function() {                           var paragraph  = $(this).next('p').text();             $('#pop-up').find('h3').append(paragraph);             $('#pop-up').show();                 }, function() {         $('#pop-up').hide();      });   }); 

here html code:

    <div id="content">     <div class="column">     <div class="article">     <img src="images/stevejobs.png" alt="steve jobs" title="stevejobs" />     <h1><a href="#"> computers changed forever</a></h1>     <p> brilliant mind of steve jobs. </p>      <a href="#" id="trigger">this link</a>                  <!-- hidden / pop-up div -->                  <div id="pop-up">                   <h3>pop-up div displayed</h3>                   </div>     </div> 

problem @ var paragraph = $(this).next('p').text();

i think want var paragraph = $(this).text();

inside $(this.parentnode).next('p').hover(function() { this paragraph node

demo

demo2

  $('.article h1 a').click(function(event) {     event.preventdefault();     $(this.parentnode).next('p').fadetoggle(1000);      $(this.parentnode).next('p').hover(function() {                           var paragraph  = $(this).text();          if( !$('#pop-up').data("appended")){// removes multiple appending             $('#pop-up').find('h3').append(paragraph);              $('#pop-up').data("appended",true)           }             $('#pop-up').show();                  }, function() {         $('#pop-up').hide();      });   }); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -