After I run my script, the input field essentially looks like this:
<input type="text" value="How do you " />
Even if I slash the quotes or change them to " it still doesn’t work.
Any suggestions?
$('input').html(function() {
var dataVal = 'How do you "feel" about that?';
return '<input type="text" value="' + dataVal + '" />';
});
Add this after the
dataValdefinition.It replaces all
"characters by the HTML entity of a quotation mark, fixing your code.Currently, your parsed HTML looks like this:
<input type="text" value="How do you "feel" about that?" />, which is translated to<input type="text" value="How do you " />.