When i executed this,
var a = trimAll(document.getElementById("txt_msg").value);
When i inspected through web developer toolbar I got the Error: trimAll is not defined..
Any suggestion…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As others have mentioned, the error is indicating that the trimAll() function has not been defined. As trimAll() is not a standard JavaScript function, you would need to write one named trimAll() in order to call it.
There are many ways to write a string trimming function. Some functions are compact, some are easy to read, others are blazing fast.
It’s worth keeping in mind that native JavaScript trim is supported in ECMAScript 5. I suspect the intention of your trimAll() function call would be the same functionality as trim().
So, if you plan to write your own trim function, it might be worth while checking for the existence of a native trim and using that in preference to your own string trimming method if you prefer.