Snippets

Customize Input Box using jQuery

Prevent users typing special characters in text box, textarea, etc.

$(document).on('keypress',':text,textarea', function () {
        if (this.value.match(/[^a-z0-9@,.'\-_) (]/gi)) { // now accept @ , - "
            this.value = this.value.replace(/[^a-z0-9@,.'\-_) (]/gi,'');
        }
    });
^[a-zA-Z]+$ Alphabets
^[a-zA-Z\s]+$ Alphabets + Space

Example:-

Recent Posts

Selecting Elements in jQuery (jQuery Selectors)

To collect a group of elements, we pass the selector to the jQuery function using…

5 years ago

jQuery library Introduction

jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is…

5 years ago

Adjust li width fit with ul width of the outer div/body

HTML:- [crayon-663c3c1e6ed05255853438/] CSS:- [crayon-663c3c1e6ed0e320371249/] JavaScript:- [crayon-663c3c1e6ed12023185652/]  

5 years ago

JavaScript simple form validation with example

Any interactive web site has form input - a place where the users input different…

5 years ago

Clear the browser cache of CSS or JavaScript Using Javascript

[crayon-663c3c1e6f283357959582/]  

5 years ago

Simple Ajax Call

[crayon-663c3c1e6f420733549424/]  

5 years ago