html - String with whitespace in javascript -
i have string "magic word". need use value in html checkbox generated javascript.
in javascript
var itemvalue= "magic task"; var opt = "<input type='checkbox' name='test' id='test' value="+ itemvalue+ "/>"+itemvalue+ "<br />"; alert(opt); $(optiondiv).append(opt);
in alert displaying actual value after submitting form getting first word value.it ignoring second word.
thanks ravi kant
you need wrap value single quotes:
"<input type='checkbox' name='test' id='test' value='" + itemvalue + "' />"
Comments
Post a Comment