var hdn_add_element_cnt = $("#hdn_add_element_cnt").val();
alert(hdn_add_element_cnt);
$('#element_area').append("<div id=\'foobar\'>This is my text
<div id=\'del_1\' onclick=\'return delete_element(\"hdn_add_element_cnt\");\'>Remove</div></div>");
function delete_element(t){
alert(t); -------------Am Getting String value instead of hdn_add_element_cnt count
//$("#"+del_1).remove();
//alert(t+hdn_add_element_cnt);
}
am holding count in hdn_add_element_cnt variable, i want this count in delete_element function,
currently am getting the string instead of count value,
how to insert the variable value in double quotes,
Please advise
Get rid of the double quotes in the onClick handler.
Also – you don’t need to escape all the single quotes.
Like this: