Search code examples
escapingextjs3

Escape single quotes in extjs


In my jsp, I have this code:

Ext.MessageBox.show({
title: "<bean:message bundle='pageRes' key='keyXXX'/>",
msg: "<bean:message bundle='pageRes' key='keYYY'/>",
prompt:true,
buttons: Ext.MessageBox.OKCANCEL,
fn: someFn,
icon: Ext.MessageBox.QUESTION
});

Now this works as expected, but my question is: for title and msg config options, how come I do not need to escape the single quotes around pageRes and keyXXX and keyYYY


Solution

  • That's because you only have to escape the single quotes if you begin your string with single quotes, and also you only need to escape the double quotes if you begin your string with double quotes.