Home > DeveloperSection > Forums > eye script validation using JavaScript
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    March-09-2013 5:21 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1111  View(s)
Rate this:

Hi Everyone!

I'm developing an eye care web application. I want to validate eye script value when user entered into textbox.

eye format script as following

+9.99 -9.99 999
or
-9.99 +9.99 999

Thanks in advance!



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    March-09-2013 8:31 AM

Hi Ankita!

You could try following line of code

<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.maskedinput.js" type="text/javascript"></script>
<script type="text/javascript">
    jQuery(function ($) {
        $.mask.definitions['~'] = '[+-]';
        $("#txtId").mask("~9.99 ~9.99 999");
    });
</script>

<input id="txtId" type="text" />

Note:
"jquery-1.7.1.min.js" provided by MVC application
"jquery.maskedinput.js" you can download from following link

https://raw.github.com/digitalBush/jquery.maskedinput/1.3.1/dist/jquery.maskedinput.min.js


Don't want to miss updates? Please click the below button!

Follow MindStick