Tuesday, November 25, 2014

Stop overflowing a HTML table and its content

If your HTML table and its content are overflowing, try this CSS combination.

table
{
            table-layout:fixed;
            width:100%;
            word-wrap:break-word;
}

Ref - http://www.456bereastreet.com/lab/table-layout-fixed/example-3.html

Saturday, November 22, 2014

.contains is undefined in JAVASCRIPT

String.contains(String) returns undefined in JS in most browsers except Mozilla firefox. We can replace above function with String.indexOf(String).

"Mycars".contains("My") returns true
"Mycars".contains("My1") returns false

"Mycars".indexOf("My") returns the index of the first character of 'My' within 'Mycars'
"Mycars".contains("My1") returns  -1