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

182
Views
How may I emulate a element with JS?

Please see following code:

<input type="hidden" id="data_set" value="{&quot;contact_email&quot;:&quot;email@email.com&quot;,&quot;basic_pckg&quot;:&quot;pip&quot;}">

<a  class="actionButton" role="button" data-container="body" data-close-location="center" data-toggle="data_set" > click here </a>

I want change it to following:

<a  class="actionButton" role="button" onclick="myfoo();" > click here </a>

in my foo I want to emulate the basic element myfoo:


function myfoo()
{
    var xxx = '{"contact_email":"new_email@email.com","basic_pckg":"ok"}';
    
    document.getElementById("data_set").value = xxx;

var _a_link = document.createElement("a");
    
    
    _a_link.className= "actionButton";
    _a_link.setAttribute("role", "button");
    _a_link.setAttribute("data-close-location", "center");
    _a_link.setAttribute("data-container", "body");
    _a_link.setAttribute("data-toggle", "data_set");

    _a_link.click();
}

and it's not working. another function foo2:

function foo2()
{
//....
that.settings = tryParseJSON($('#data_set').val()); 
// contact_email == email@email.com
// instead of new_email@email.com
//...
}

Can you help please?

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!