Q:

Literal quote mark in HTML input value

I am dynamically converting a  list of options to a series of radio buttons.  One of the values that is in the option has a literal quote mark.
<option value="6\" tall">

When I loop through each option, pull the a value $(this).val();  then I build a string for the radio button:
rb="input id=\"CTRL"+fld+"_"+cnt+"\" name=\""+fld+"\" type=\"radio\" "+ sel+" value=\"" +val+ "\"" +valCaption";

If I debug and break on this, the string is created correctly, but when I insert the element, the literal in the value is lost and the result is:
<input id="CTRLText1_3" name="Text1" type="radio" value="Rev 6" tall"="">

I cannot escape the value because then the value doesn't actually match what is being returned by the original select list.
Any ideas how I can create this radio button?

A:

Thank you for everyone's suggestions. I did find the problem. I actually had to first collect the values from the options, then build the radio buttons with a blank value attribute and add that to the page.  Then loop back through and just the $(fieldid).val(value) to set the values.
The other issue with saving the value then putting our page back into edit mode and the value not being re-selected.  The ultimate problem is a bug in the core of the software where its not correctly comparing the stored value to the value in the list.

