validation city name from regex in javascript

Mostly this pattern used for US cities. It will be accept small and capital character, space, desh and full stop.

if (/[^a-zA-Z .,]/.test(txtCity.value)) {
          alert('Invalid city name');
     }
else {
          alert('Valid city name');
     }

Comments

Popular posts from this blog

Add Image through base64 on PDF in itextsharp

Set span value using jquery and javascript

how to insert text and tags at the cursor CKEDITOR