Please see following code:
<input type="hidden" id="data_set" value="{"contact_email":"email@email.com","basic_pckg":"pip"}">
<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?