jQWidgets Forums
jQuery UI Widgets › Forums › Editors › MaskedInput › How to clear the value?
Tagged: clearValue, jqxmaskedinput
This topic contains 2 replies, has 2 voices, and was last updated by dlowery 12 years, 2 months ago.
-
AuthorHow to clear the value? Posts
-
have a MVC project that I can not clear the value.
the init code is
$(“#phoneInputLA1”).jqxMaskedInput({ width: 70, mask: ‘###-####’, value: ‘@Model.ListingAgent1AdPhoneNum’, theme: ‘energyblue’ });where the model has the initial value, works fine
and when I try to clear the current value to blank using
$(‘#phoneInputLA1’).jqxMaskedInput(‘inputValue’, “”);nothing changes, I tried $(‘#phoneInputLA1’).jqxMaskedInput(‘inputValue’, null);
neither worked.
I have tried val also, no diff.
thanks!
Hi dlowery,
In order to clear the current value in the jqxMaskedInput you can use the clearValue method. Please take a look at the following example in which the method is used with a button(you can use it separately too):
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/gettheme.js"></script> <script type="text/javascript" src="../../scripts/jquery-1.9.0.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmaskedinput.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript"> $(document).ready(function () { var theme = getDemoTheme(); // Create jqxMaskedInputs $("#numericInput").jqxMaskedInput({ width: '250px', height: '25px', theme: theme }); // add clear button. $("#clearButton").jqxButton({ theme: theme }); // clear all values when the button is clicked. $("#clearButton").click(function () { $("#numericInput").jqxMaskedInput('clearValue'); }); }); </script></head><body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div style='margin-top: 10px;'> Numeric</div> <div style='margin-top: 3px;' id='numericInput'> </div> <input style="margin-top: 10px;" type="button" id="clearButton" value="Clear Values" /> </div></body></html>
Best Wishes,
MariyajQWidgets Team
http://www.jqwidgets.comThanks!, I don’t see that in the documentation.
-
AuthorPosts
You must be logged in to reply to this topic.