jQuery.fn.exists = function () {
return this.length !== 0
}
jQuery.expr[":"].ContainsIgnoreCase = jQuery.expr.createPseudo(function(arg) {
return function( elem ) {
return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
<?php
if (empty($_GET['background'])) { // если нет get-параметра с цветом
$background = '#ffffff';
} else { // если есть - используем его
$background = $_GET['background'];
// по хорошему, здесь нужно бы проверять на JS инъекции
// или как-то экранировать
}
/*
а теперь нужно куда-то сохранить это измененный цвет. в сессию, в базу данных, в файл и т.д.
*/
?>
$('.numeric-only').keydown(function (e) {
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Allow: Ctrl+A
(e.keyCode == 65 && e.ctrlKey === true) ||
// Allow: home, end, left, right
(e.keyCode >= 35 && e.keyCode <= 39)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
str_replace('поиск по google.com', '<a href="#">поиск по google.com</a>', $myText)
myText.replace(/(поиск по google\.com)/g, '<a href="#">$1</a>')
$('#myForm').on('submit', function(){
// здесь проверяем что хотим, показываем ошибки или return true.
})