0

I have

<input type="text" class="required" ... />

Is it possible for me to write inside class i required the particular field to number only

I tried

<input type="text" class="number" ... /> and <input type="text" class="{required:true, number:true}" ... />

Is it possible and any idea how? Thanks

1
  • The class attribute should consist of space separated tokens (see HTML standard) Commented Apr 4, 2012 at 1:41

2 Answers 2

1

Try class="required number", see jQuery example here, or run this fiddle:

<html>
    <head>
        <script type="application/javascript">

        $(document).ready(function(){
            $("#test-form").validate();
            // don't really process form
            $("#test-form").submit(function() { return false; });
        });​

        </script>
    </head>
    <body>
        <form id="test-form" action="" >
            <input type="text" class="required number" />
            <input type="submit" />
        </form>
    </body>
</html>

Also, see my comment.

Sign up to request clarification or add additional context in comments.

1 Comment

very very sorry my friend, there was an error previously on form, that why its not working.. Thank you!
0

Maybe you could use a mask for the input text?

See: http://digitalbush.com/projects/masked-input-plugin/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.