I’m creating the following div using javascript, task_id is an int and person_name is a string, why is my alert not working!
when i send 2 integers, the alert works fine, when i send 2 strings the alert still doesn’t work, what am i doing wrong?
'<div " onMouseOver="Drag(' + task_id + ',' + person_name +');"</div>'
.....
function Drag(id, name){
alert(id + " " + name);
}
thanks a million in advance
You need to correctly add escaped string delimiters around the string, otherwise you’re sending a variable with the name of
person_name‘s value. Try: