Reputation: 306
I'm adding an hidden input as something in a select is choosen, using the onchange event with some jsp vars. I add some text to the div I'm working on but there are too many quotes and double quotes so I don't understand how to do it. Does anyone have any idea?
<select name="opt_name%>" onchange="$('#dati_opzioni').append('<input type="hidden" name="optdesc_'+<%=opt.getCdOpzione()%>+'" value="'+<%=optLabel%>+'_'+this.options[this.selectedIndex].text+'"/>');">
Upvotes: 0
Views: 349
Reputation: 4523
try this:
<select name="<%=opt_name%>" onchange="$('#dati_opzioni').append('<input type=""hidden"" name=""optdesc_'+<%=opt.getCdOpzione()%>+'"" value=""'+<%=optLabel%>+'_'+this.options[this.selectedIndex].text+'""/>');">
Upvotes: 0
Reputation: 3924
Try using html entities for double quotes (as & quot; without blanks) inside the onchange="..."
<select name="opt_name%>" onchange="$('#dati_opzioni').append('<input type="hidden" name="optdesc_'+<%=opt.getCdOpzione()%>+'" value="'+<%=optLabel%>+'_'+this.options[this.selectedIndex].text+'"/>');">
Upvotes: 1