Regular Expression to Strip HTML from String

Posted: July 12th, 2010 | Author: | Tags: , , | No Comments »

I used this in a simple reguar expression to strip html

/<(?:.|\s)*?>/g

An example of using this in a javascript function is as such…

function stripHtml(html)
{
    return html.replace(/<(?:.|\s)*?>/g, "");
}

Javascript options hash

Posted: July 9th, 2010 | Author: | Tags: , | No Comments »
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function sample(options){
    var settings = $.extend({
        option1: null,
	option2: null,
	option3: null,
	option4: null
    },options||{}); //If no options, pass empty object
 
    // using settings within function
    console.log(settings.option1);
};
 
// calling the function
sample({option1: 'some value'});