I’m working on an application that requires a text field to fade in with the value being loaded by AJAX. (I’m doing this all with jQuery), here’s the code:
$('div#p'+eId+'_content').html('<input class='editPost' type='text' value='' + oldCont + '' id='p' + eId + '_editBox' />');
Unfortunatly, oldCont can contain single quotes, which means the textbox will only contain oldPost up until that single quote. How could I display oldCont without having that problem, but still retaining that single quote (without the \ from escaping it)?
…I think those parens line up ….. 🙂
basically, use the val function on a jquery object and it’ll take care of the escaping for you. Similarly you can use the addClass, attr, etc. functions for other pieces of your html objects