I want to restrict the user in toolbar search by not allowing him/her using Some Special Characters like (\'/\',\'>\',\'<\',\'|\').Please help me out.
$(\
If you want allow only some special characters are entered in the input field of the search toolbar you can use dataEvents of the searchoptions
defined using type:'keypress'
or type:'keydown'
. It will follows to call jQuery.bind
and jQuery.unbind
for the corresponding input field. The code fragment which allows only digits is following
searchoptions: {
dataEvents: [
{
type: 'keypress', // keydown
fn: function(e) {
// console.log('keypress');
if(e.keyCode >=48 && e.keyCode <=57) {
// allow digits
return true;
} else {
// disallow the key
return false;
}
}
}
]
}
In the live demo you will be not able to enter digits in the search field for the 'Name'.