javascript void(0) for HTML link

May 27, 2012

To create a HTML link which does nothing when user clicks it,  use  like below

<A HREF="javascript:void(0)">Click here to do nothing</A>

When the user clicks the link, void(0) evaluates to undefined, which has no effect in JavaScript.

References –

Here is a link, which answers why  void(0)  is better than using #  for this requirement

Internet Explorer min-width CSS property does not work

July 13, 2011

If the min-width property does not work in Internet Explorer

check if your html has DOCTYPE setup.

min-width details from MSDN site –
states that

This property is enabled only under the strict !DOCTYPE.

Difference between Div and Span tag

January 27, 2011

Good article in the link below about this

Simple point to keep the difference in your mind is Div tag adds new line , Span tag does not

Convert JSON Object to String javascript

January 26, 2011

you can user browser native function JSON.stringify to do this

var foo = {}; = "new property";
foo.baz = 3;

var jsonString = JSON.stringify(foo);

And IE8 also supports it –

jQuery Template plugin html in variables

January 25, 2011

If you pass html content in the template variables, you have to use {{html ..}} format to make sure that the html content gets converted into real html elements.

See this Stack overflow post

And this documentation –

Javascript code equivalent to java i18n MessageFormat

January 25, 2011

Here is a Stack overflow post with javascript regex solution for this problem.

How to center a div inside a div

January 17, 2011

If you need to center a div within another div, here is the solution from Stack overflow post –