Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139923

quotes problems between freemarker, java and javascript

$
0
0

i have a problem with single quotes, sending a word (for ex: patte't) from java to html (freemarker) then use the variable on a "onClick" js function

I have already tried to have an extra escape in java but the variable display will contains '\'(patte\'t). The onClick works fine in this case. If i use a simple escape in java, the variable display is fine but the onClick deosn't work (parameter like: onClick('patte't')), i got an error in this case.

<tr id="contactList" onclick="Ws('${contact.id!''}','${contact.name!''}');">
some <td>
</tr>
contact.name contains a single quote in his value



ex:
Java send: pette't
html displays: pette't
onClick: error(onClick('patte't'))

Thanks everyone

Viewing all articles
Browse latest Browse all 139923

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>