1. Download Masked Input Plugin by digitalBush
2. If you’re using Yii, create folder js outside the protected folder, store the js file inside there, put this code in your page.
<?php
$cs=Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl.’/js/jquery.maskedinput-1.2.2.js’,CClientScript::POS_HEAD);
?>
$cs=Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl.’/js/jquery.maskedinput-1.2.2.js’,CClientScript::POS_HEAD);
?>
3. Then, assign the field to be masked
<SCRIPT language=”javascript”>
$(‘#date_1′).mask(“99-99-9999″,{placeholder:”_”});
</SCRIPT>
No comments:
Post a Comment