Wednesday, October 9, 2013

Jquery textbox accept only alpha characters

HTML


Jquery

$('#alphaonly').bind('keypress', function (event) { var regex = new RegExp("^[a-zA-Z]+$"); var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); if (!regex.test(key)) { event.preventDefault(); return false; } });

Thursday, October 3, 2013

Browser specific hack


Chrome Hack only

@media screen and (-webkit-min-device-pixel-ratio:0) { .ar #form-wrapper { width: 330px; } }

Firefox Hack only

@-moz-document url-prefix() { .submit_btn { padding-bottom: 5px; } }

IE8 Hack

@media screen { .item { background: #000; } }

IE9 Hack

:root #nav li.last-page-item a { padding-right:8px\9; }

coloe:red\9; hack works on IE9

Javascript find highest and lowest from the given inputs

function highAndLow(numbers){ // numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"   let numbersInArr = numbers.split(' '...