javascript - How to check if a comma was used in an input tag? -


i have few input tags, , ajax script converts values string separated commas before sending php script. if uses comma in input tags, breaks read method, values broken. tags aren't meant text, , there no reason use one, in case, how check if user used comma, using jquery.

ideally, want:

$('element').keyup(function(event) {       if(){//previous value comma         alert('commas not allowed!!');         //code delete comma       }     }); 

thanks.

you can use indexof on value of current input value.

 if(this.value.indexof(',') !== -1)  {     //comma in input not allowed   } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -