Reputation: 15501
This should be simple but for some reason I am not getting it right. :/
I am using the jQuery masked input plugin available here
The following is my code snippet:
jQuery:
<script>
$(document).ready(function(){
$("#newStudentForm").validate();
});
jQuery(function($){
$("#Sphone").mask("(999) 999-9999");
});
</script>
HTML:
<input type="text" maxlength="10" name="Sphone" id="Sphone" size="28px"/>
As of now, I cannot see any mask in the textbox. How do I fix this?
Upvotes: 0
Views: 252
Reputation: 1406
Based on the information you gave me, I got it working at http://jsfiddle.net/Sgu6e/.
Here's what I did:
I removed the line $("#rad1").buttonset();
as it did not apply to the code you gave me and was breaking the rest of the JS.
Then I changed the rest of the JS to the following:
$(document).ready(function() {
$("#newStudentForm").validate();
$("#Sphone").mask("(999) 999-9999");
});
Again, you can see it working at http://jsfiddle.net/Sgu6e/.
Upvotes: 1
Reputation: 87073
CHECK that you include the plugin file
<input type="text" maxlength="10" name="Sphone" id="Sphone" size="28"/> // not `28px`
$(document).ready(function(){
$("#newStudentForm").validate();
$("#Sphone").mask("(999) 999-9999");
});
Upvotes: 2