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
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.
Maybe you could use a mask for the input text?
class
attribute should consist of space separated tokens (see HTML standard - Yuval 2012-04-04 01:41