var some_search='Search..';
$( document ).ready(function() {
/*
I used [`~!@#$%^&*()|+=?;:'",.<>\{\}\[\]\\\/] versus [^\w\s-_] because JavaScript does not work well with UTF-8
and does not recognize the word boundaries in utf8.
*/
$(function(){
$('#searchsite').keyup(function() {
var yourInput = $(this).val();
re = /[`~!@#$%^&*()|+=?;:'",.<>\{\}\[\]\\\/]/gi;
var isSplChar = re.test(yourInput);
if(isSplChar)
{
var no_spl_char = yourInput.replace(re, '');
$(this).val(no_spl_char);
}
});
$('#searchsite').bind("paste", function() {
setTimeout(function() {
//get the value of the input text
var data= $( '#searchsite' ).val() ;
//replace the special characters to ''
var dataFull = data.replace(/[`~!@#$%^&*()|+=?;:'",.<>\{\}\[\]\\\/]/gi, '');
//set the new value of the input text without special characters
$( '#searchsite' ).val(dataFull);
});
});
});
});
Plikli is an open source content management system that lets you easily create your own user-powered website.