can you please tell me how to catch space in textfield .I block all special character .But I need if user click add space button it don't show alert but it wrap the text mean not allowed space.
$(document).on( "keyup", ".caseName_h",function() {
alert("hh"+$(this).val().contains(" "));
if($(this).val()==" "){
alert("hh");
}
if(/[^\w]/g.test($(this).val())) {
$(this).val($(this).val().replace(/[^\w]/g, ""));
PG_alert('Special characters not allowed!');
}
});