/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/
I haveused that pattern on my project for Tele2Music
From: http://regexlib.com/REDetails.aspx?regexp_id=73
/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]{11}$/
Checks if there is exectly 11 digits in a number
function elementInViewport (el) { | |
var top = el.offsetTop; | |
var left = el.offsetLeft; | |
var width = el.offsetWidth; | |
var height = el.offsetHeight; | |
while(el.offsetParent) { | |
el = el.offsetParent; | |
top += el.offsetTop; | |
left += el.offsetLeft; |
//Задача: убирать нативную клавиатуру после ввода параметра в поле поиска и выдачи результатов | |
//Данную функцию вызывать на 'success' выполнения запроса | |
var hideKeyboard = function() { | |
document.activeElement.blur(); | |
$("input").blur(); | |
}; | |
//Страница с вопросом: http://stackoverflow.com/questions/5937339/ipad-safari-make-keyboard-disappear |
;(function(Modernizr, window) { | |
Modernizr.addTest('positionfixed', function () { | |
var test = document.createElement('div'), | |
control = test.cloneNode(false), | |
fake = false, | |
root = document.body || (function () { | |
fake = true; | |
return document.documentElement.appendChild(document.createElement('body')); | |
}()); |
//На одном из проектов оказалось, что достаточно добавить body position:fixed | |
//Ситуация была: на мобильных меню при открытии становилось fixed, но при прокрутке снизу из-за адресной строки появлялся "провал" | |
//Так же для манипуляции меню к body добавлялся класс .show-nav | |
//В моей ситуации оказалось достаточно просто добавить в show-nav position: fixed (пофиксить body) | |
function hideAddressBar() | |
{ | |
if(!window.location.hash) | |
{ | |
if(document.height < window.outerHeight) |
(function (w) { | |
'use strict'; | |
w.location.hash = "no-back-button"; | |
w.location.hash = "Again-No-back-button";//again because google chrome don't insert first hash into history | |
w.onhashchange = function(){ | |
w.location.hash = "no-back-button"; | |
} | |
/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/
I haveused that pattern on my project for Tele2Music
From: http://regexlib.com/REDetails.aspx?regexp_id=73
/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]{11}$/
Checks if there is exectly 11 digits in a number
Add the following code to add trim functionality to the string.
if ( typeof String.prototype.trim !== 'function' ) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
So, I'm going to guess finish typing means you just stop for a while, say 5 seconds. So with that in mind, lets start a timer when the user releases a key and clear it when they press one. I decided the input in question will be #myInput.
Making a few assumptions...
//setup before functions
var typingTimer; //timer identifier
var doneTypingInterval = 5000; //time in ms, 5 second for example
//on keyup, start the countdown
Is IE8 your new IE6? Level the playing field with polyfills.
This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.
addEventListener registers a single event listener on a single target.
var express = require('express'); | |
var app = express(); | |
function productCount(){ | |
return Math.round(Math.random() * 10 + 1); | |
} | |
function times(n, callback){ | |
var list = []; |