I want to check that weather any data entered in editor or not. I got value in java script by this function:
var txtMsgValue = dojo.widget.byId('newsdisplay').getEditorContent();
And checking that
if(txtMsgValue == null || txtMsgValue == '') {
alert ("Message is requird for mail.");
Return false;
}
it works fine it nothing entered in editor but if i entered only blank space by 'spacebar', it doesn't check. It gives me correct length... (Means correct count of how many spaces I entered)... But when I tried to trim that... by this function:
txtMsgValue = txtMsgValue.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
It doesn’t work. It just trimmed only 1 blank space.
Please give me solution, I desperately need that.
Thanks in advance.
try dojo.string.trim()
Try using dojo.string.trim().
dojo.require("dojo.string"); var txtMsgValue = dojo.string.trim(dojo.widget.byId('newsdisplay').getEditorContent());Post new comment