jquery - ReferenceError in javascript. Character undefined in append function -
adding tags using append function jquery.
here jquery code it's blocking
tabsections(data).foreach(function(section){ $("#sections nav ul").append("<li id='section_"+section+"' class='list_section' onclick='addtext("+section+")'>" + section + "</li>"); });
and html code browser
<li onclick="addtext(287585-c)" class="list_section" id="section_287585-c">287585-c</li>
when click on li tag, calls function addtext(section){} defined. reference error i'm getting doesn't recognize i'm passing function complete string 2 numbers (a subtraction). why error stating c not defined raised.
i'm trying html code should this
<li onclick="addtext('287585-c')" class="list_section" id="section_287585-c">287585-c</li>
how can modify javascript code have 2 quotation mark appear in html code (and/or javascript interprets argument string , not 2 numbers) ? error raised once click on tag
the tostring() function didn't either.
thanks in advance
tabsections(data).foreach(function(section){ $("#sections nav ul").append('<li id="section_'+section+'" class="list_section" onclick="addtext(\''+section+'\')">' + section + '</li>'); });
didnt run it...but try it
Comments
Post a Comment