I have set up a little web application where you add post-its to a page. It\'s just a project to help better learn JavaScript/jQuery and it seemed like an appropriate projec
You have three issues: One is that the method is not returning properly (that's the fault of whoever wrote it). Next is that you are defining the method within $(document).ready()
, so it is not able to be found (at least in Chrome). Third, you are not calling it the right way (onSubmit
will never be used here).
I've used @Joao's method (so you should upvote his answer) and used this method, moved outside of the ready()
function:
function stripHTML(str){
var strippedText = $("").html(str).text();
return strippedText;
}
And also called it here:
var post = stripHTML($(".text_input").val())
Here is the working fiddle: http://jsfiddle.net/ee3MH/