Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
How to hover over data inserted from JSON

I have a file where I take information from a JSON and insert it into a div:

document.getElementById('display_area').innerHTML += "<p>" + jsonData[obj]["name"] + "</p>";

I want to be able to hover over this data and fade it out, so I have:

$( "p" ).hover(function() {
    $( "p" ).fadeOut( 100 );
  });

The problem is, it doesn't recognize it as a p, so it doesn't do anything.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can append your json data and then add hover dynamically.

var jsonData = { obj : { name : "ARIA Meyer"} }

$(document).ready(function() {
    $("#display_area").append(`
    <p>${jsonData['obj']["name"]}</p>
    `);
    
    $( "p" ).hover(function() {
    $( "p" ).fadeOut(500);
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<div id="display_area"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!