javascript - rendering anchor href with json2html -
i trying render anchor json2html following transform:
'rendertimeline':[ { tag: "a", class: "btn btn-warning btn-circle", style: "float: right;", html: "<i class=\"icon-remove\"></i>", "href": function() { var myhref = "javascript:delschedule(" + + ");"; return myhref; } }]
intention delete json object,which passed :
$('#suntimeline').json2html(sched1.sunday, transforms.rendertimeline, {'events':true});
i following o/p on rendered html:
<a class="btn btn-warning btn-circle" style="float: right;" href="javascript:delschedule([object object]);"><i class="icon-remove"></i></a>
when click on link(button) message in browser console:
syntaxerror: missing ] after element list
please me solve issue.
assuming trying pass reference of clicked element delschedule
function, need change href
definition this:
"href": function() { var myhref = "javascript:delschedule(this);"; // note 'this' part of string, not concatenated return myhref; }
Comments
Post a Comment