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

217
Views
get value html to jquery or javascript

I want retrieve text value from id 'isinama2', but if I check with console.log then the value is empty, can someone help me to solve this problem?

$('#btncurhat').click(function(){
    var textcurhat = $('#textcurhat').val()
    var isinama = $('#isinama2').text()
    var penyimpanan2 = localStorage.getItem('data_curhat')
    console.log(isinama)}

I have tried

var isinama = $('#isinama2').val()

it's my full code

aa = JSON.parse(localStorage.getItem("a"))
    $('#isinama').text('Welcome ' + aa)   

 $('#btncurhat').click(function(){
            var textcurhat = $('#textcurhat').val()
            var isinama = $('#isinama2').text()
            var penyimpanan2 = localStorage.getItem('data_curhat')

            if(penyimpanan2){
                penyimpanan2 = JSON.parse(penyimpanan2)
            }else{
                penyimpanan2 = []
            }
            var myjson2 = {textcurhat, isinama}
            penyimpanan2.push(myjson2)

            //console.log(myjson2)
            //console.log(penyimpanan2)

            localStorage.setItem('data_curhat', JSON.stringify(penyimpanan2))   

            $('#textcurhat').val('')    

            var entry2 = JSON.parse(localStorage.getItem('data_curhat'));

            $("#listcurhat").empty();

            $.each(entry2, function (i, data){
                    $('#listcurhat').append('<div class="card mb-3" style="max-width:24rem;"><div class="card-header" id="isinama2">'+ aa +'</div><div class="card-body"><p class="card-text">'+ data.textcurhat  +'</p></div></div>')
                })

            //localStorage.removeItem("data_curhat");

        })
about 4 years ago · Juan Pablo Isaza
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!