jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
639 lines (631 loc) • 33.6 kB
HTML
<html lang="en">
<head>
<link rel="stylesheet" href="../../../../styles/jqx.apireference.css" type="text/css" />
<script type="text/javascript" src="../../../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../../../scripts/documentation.js"></script>
<meta name="keywords" content="jQuery, Mask Input, Masked Input, MaskedInput, MaskBox, Mask TextBox, Input Mask, Input, jqxMaskedInput" />
<meta name="description" content="This page represents the help documentation of the jqxMaskedInput widget." />
<title>jqxMaskedInput API Reference</title>
<script type="text/javascript">
$(document).ready(function () {
$(".documentation-option-type-click").click(function (event) {
$(event.target).parents('tr').next().find(".property-content").toggle();
});
});
</script>
</head>
<body>
<div id="properties">
<h2 class="documentation-top-header">Properties</h2>
<table class="documentation-table">
<tr>
<th>Name
</th>
<th>Type
</th>
<th>Default
</th>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span7'>disabled</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>false
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets whether the widget is disabled.
</p>
<h4>Code examples</h4>
<p>
Set the <code>disabled</code> property.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ disabled: true});<code></code></pre>
<p>
Get the <code>disabled</code> property.
</p>
<pre><code>var disabled = $('#jqxMaskedInput').jqxMaskedInput('disabled');</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/fpjxzo1e/">disabled is set to true</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span3'>height</span>
</td>
<td>
<span>Number/String</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets height of the masked input in pixels.
</p>
<h4>Code examples</h4>
<p>
Set the <code>height</code> property.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ height: '25px'});<code></code></pre>
<p>
Get the <code>height</code> property.
</p>
<pre><code>var height = $('#jqxMaskedInput').jqxMaskedInput('height');</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/Z3QQB/">height is set to '25px'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span1'>mask</span>
</td>
<td>
<span>String</span>
</td>
<td>'#####'
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the masked input's mask.
</p>
Mask characters:
<ul>
<li># - For digit character. Accepts values from 0 to 9
</li>
<li>9 - For digit character. Accepts values from 0 to 9
</li>
<li>0 - For digit character. Accepts values from 0 to 9
</li>
<li>A - For alpha numeric character. Accepts values from 0 to 9 and from a to z and A to Z.
</li>
<li>L - For alpha character. Accepts values from a to z and A to Z
</li>
<li>[abcd] - For character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen. For example, [abcd] is the same as [a-d].
Examples: [0-5] - accepts values from 0 to 5. [ab] - accepts only a or b.
</li>
</ul>
<h4>Code examples</h4>
<p>
Set the <code>mask</code> property.
</p>
<pre><code>$("#jqxMaskedInput").jqxMaskedInput({ mask: '###-##-####'});</code></pre>
<p>
Get the <code>mask</code> property.
</p>
<pre><code>var mask = $('#jqxMaskedInput').jqxMaskedInput('mask');</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/U6MaA/">mask is set to '###-##-####'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span6'>promptChar</span>
</td>
<td>
<span>String</span>
</td>
<td>"_"
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the prompt char displayed when an editable char is empty.
</p>
<h4>Code examples</h4>
<p>
Set the <code>promptChar</code> property.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ promptChar: "." });<code></code></pre>
<p>
Get the <code>promptChar</code> property.
</p>
<pre><code>var promptChar = $('#jqxMaskedInput').jqxMaskedInput('promptChar'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/HzcHt/">promptChar is set to "#"</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span5'>readOnly</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>false
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the readOnly state of the input.
</p>
<h4>Code examples</h4>
<p>
Set the <code>readOnly</code> property.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ readOnly: true });<code></code></pre>
<p>
Get the <code>readOnly</code> property.
</p>
<pre><code>var readOnly = $('#jqxMaskedInput').jqxMaskedInput('readOnly'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/xEU4D/">readOnly is set to true</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span51'>rtl</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>false
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts.</p>
<h4>Code example</h4>
<p>
Set the <code>rtl</code> property.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput({rtl : true}); </code></pre>
<p>
Get the <code>rtl</code> property.
</p>
<pre><code>var rtl = $('#jqxMaskedInput').jqxMaskedInput('rtl'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/GKWAm/">rtl is set to true</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span63'>theme</span>
</td>
<td>
<span>String</span>
</td>
<td>''
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets the widget's theme.
</p>
jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file.
In order to set a theme, you need to do the following:
<ul>
<li>Include the theme's CSS file after jqx.base.css.<br />
The following code example adds the 'energyblue' theme.
<pre><code>
<pre><code><link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.energyblue.css" type="text/css" />
</code></pre>
</code></pre>
</li>
<li>Set the widget's theme property to 'energyblue' when you initialize it.
</li>
</ul>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/9kvC6/">theme is set to 'energyblue'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span4'>textAlign</span>
</td>
<td>
<span>String</span>
</td>
<td>left
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the text alignment.
</p>
<b>Possible Values:</b>
<br />
<pre><code>'right'</code></pre>
<pre><code>'left'</code></pre>
<h4>Code examples</h4>
<p>
Initialize a MaskedInput with the <code>textAlign</code> property specified.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ textAlign: "right"});<code></code></pre>
<p>
Get the <code>textAlign</code> property.
</p>
<pre><code>var textAlign = $('#jqxMaskedInput').jqxMaskedInput('textAlign'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/GMfJD/">textAlign is set to 'right'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='property-name-disabled'>value</span>
</td>
<td>
<span>String</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the masked input's value.
</p>
<h4>Code examples</h4>
<p>
Set the <code>value</code> property.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput({value: "35" });</code></pre>
<h4>Code examples</h4>
<p>
Get the <code>value</code> property.
</p>
<pre><code>var value = $('#jqxMaskedInput').jqxMaskedInput('value');</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/UskHv/">value is set to 300</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span2'>width</span>
</td>
<td>
<span>Number/String</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets width of the masked input in pixels. Only positive values have effect.
</p>
<h4>Code examples</h4>
<p>
Set the <code>width</code> property.
</p>
<pre>$('#jqxMaskedInput').jqxMaskedInput({ width: '250px'});<code></code></pre>
<p>
Get the <code>width</code> property.
</p>
<pre><code>var width = $('#jqxMaskedInput').jqxMaskedInput('width');</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/mbaZ2/">width is set to '250px'</a>
</div>
</div>
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<h2 class="documentation-top-header">Events</h2>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span9'>change</span>
</td>
<td>
<span>Event</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
This event is triggered when the value is changed and the control's focus is lost.
</p>
<h4>Code examples</h4>
<p>
Bind to the <code>change</code> event by type: jqxMaskedInput.
</p>
<pre><code>
$('#jqxMaskedInput').on('change',
function (event)
{
var value = event.args.value;
var text = event.args.text;
var type = event.args.type; // keyboard or null depending on how the value was changed.
});
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/94ssJ/">Bind to the change event by type:jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span27'>valueChanged</span>
</td>
<td>
<span>Event</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
This event is triggered when the value is changed.
</p>
<h4>Code examples</h4>
<p>
Bind to the <code>valueChanged</code> event by type: jqxMaskedInput.
</p>
<pre><code>
$('#jqxMaskedInput').on('valueChanged',
function ()
{
var value = event.args.value;
var text = event.args.text;
});
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/YhwxH/">Bind to the valueChanged event by type:jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<h2 class="documentation-top-header">Methods</h2>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span11'>clear</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Clears the value.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>None</em></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>None</em>
</div>
<h4>Code examples</h4>
<p>
Invoke the <code>clear</code> method.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput('clear'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/868Dz/">clears the jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span68'>destroy</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Destroys the widget.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>None</em></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>None</em>
</div>
<h4>Code examples</h4>
<p>
Invoke the <code>destroy</code> method.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput('destroy'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/4UVA8/">destroys the jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span10'>focus</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Focuses the widget.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>None</em></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>None</em>
</div>
<h4>Code examples</h4>
<p>
Invoke the <code>focus</code> method.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput('focus'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/7tQLD/">focuses the jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span24'>val</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets or gets the value.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>value</em></td>
<td>String</td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>String</em>
</div>
<h4>Code examples</h4>
<p>
Get the value using the val method.
</p>
<pre><code>var value = $('#jqxMaskedInput').jqxMaskedInput('val');</code></pre>
<br />
// Get the value using jQuery's val.
<pre><code>var value = $('#jqxMaskedInput').val();</code></pre>
<p>
Set the value using the val method.
</p>
<pre><code>$('#jqxMaskedInput').jqxMaskedInput('val', 1242);</code></pre>
<br />
// Set the value using jQuery's val.
<pre><code>$('#jqxMaskedInput').val(1242);</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/sNbe7/">sets the value of the jqxMaskedInput </a>
</div>
</div>
</td>
</tr>
</table>
<br />
</div>
</body>
</html>