Q:

Strip html tags before callback

I use AjaxHelper.BeginForm to create ajax form in my view. The view has a textarea to provide content. How can I remove html tags from this textarea before form is submited. What I mean:

user clicks 'button' 
tags are stripped 
callback is made.

A:

You can use a regular expression to remove HTML tags from a string, but note that it is not 100% reliable.
$("button").click(function() {
    var text = $("#someElement").val().replace(/(<([^>]+)>)/ig, "");

    // make callback with above variable...
});

