Wednesday, February 5, 2014

How to check string contain special character or not ?

 <script type="text/javascript">
    $(function() {
        $('#btnClick').click(function() {
            var str = $('#txtName').val();
            if (/^[a-zA-Z0-9- ]*$/.test(str) == false) {

                // Message

            }
        })
    })
</script>


No comments:

Post a Comment