Properties

Name Type Default
disabled Boolean false

Sets or gets whether the widget is disabled.

Code examples

Set the disabled property.

$('#jqxMaskedInput').jqxMaskedInput({ disabled: true});

Get the disabled property.

var disabled = $('#jqxMaskedInput').jqxMaskedInput('disabled');
Try it: disabled is set to true
height Number/String null

Sets or gets height of the masked input in pixels.

Code examples

Set the height property.

$('#jqxMaskedInput').jqxMaskedInput({ height: '25px'});

Get the height property.

var height = $('#jqxMaskedInput').jqxMaskedInput('height');
Try it: height is set to '25px'
mask String '#####'

Sets or gets the masked input's mask.

Mask characters:
  • # - For digit character. Accepts values from 0 to 9
  • 9 - For digit character. Accepts values from 0 to 9
  • 0 - For digit character. Accepts values from 0 to 9
  • A - For alpha numeric character. Accepts values from 0 to 9 and from a to z and A to Z.
  • L - For alpha character. Accepts values from a to z and A to Z
  • [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.

Code examples

Set the mask property.

$("#jqxMaskedInput").jqxMaskedInput({ mask: '###-##-####'});

Get the mask property.

var mask = $('#jqxMaskedInput').jqxMaskedInput('mask');
Try it: mask is set to '###-##-####'
promptChar String "_"

Sets or gets the prompt char displayed when an editable char is empty.

Code examples

Set the promptChar property.

$('#jqxMaskedInput').jqxMaskedInput({ promptChar: "." });

Get the promptChar property.

var promptChar = $('#jqxMaskedInput').jqxMaskedInput('promptChar'); 
Try it: promptChar is set to "#"
readOnly Boolean false

Sets or gets the readOnly state of the input.

Code examples

Set the readOnly property.

$('#jqxMaskedInput').jqxMaskedInput({ readOnly: true });

Get the readOnly property.

var readOnly = $('#jqxMaskedInput').jqxMaskedInput('readOnly'); 
Try it: readOnly is set to true
rtl Boolean false

Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts.

Code example

Set the rtl property.

$('#jqxMaskedInput').jqxMaskedInput({rtl : true}); 

Get the rtl property.

var rtl = $('#jqxMaskedInput').jqxMaskedInput('rtl'); 
Try it: rtl is set to true
theme String ''

Sets the widget's theme.

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:
  • Include the theme's CSS file after jqx.base.css.
    The following code example adds the 'energyblue' theme.
    
    
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.energyblue.css" type="text/css" />
    
  • Set the widget's theme property to 'energyblue' when you initialize it.
Try it: theme is set to 'energyblue'
textAlign String left

Sets or gets the text alignment.

Possible Values:
'right'
'left'

Code examples

Initialize a MaskedInput with the textAlign property specified.

$('#jqxMaskedInput').jqxMaskedInput({ textAlign: "right"});

Get the textAlign property.

var textAlign = $('#jqxMaskedInput').jqxMaskedInput('textAlign'); 
Try it: textAlign is set to 'right'
value String null

Sets or gets the masked input's value.

Code examples

Set the value property.

$('#jqxMaskedInput').jqxMaskedInput({value: "35" });

Code examples

Get the value property.

var value = $('#jqxMaskedInput').jqxMaskedInput('value');
Try it: value is set to 300
width Number/String null

Sets or gets width of the masked input in pixels. Only positive values have effect.

Code examples

Set the width property.

$('#jqxMaskedInput').jqxMaskedInput({ width: '250px'});

Get the width property.

var width = $('#jqxMaskedInput').jqxMaskedInput('width');
Try it: width is set to '250px'

Events

change Event

This event is triggered when the value is changed and the control's focus is lost.

Code examples

Bind to the change event by type: jqxMaskedInput.


$('#jqxMaskedInput').on('change',
function (event) 
{
    var value = event.args.value;
    var text = event.args.text;
  // type 
    var type = event.args.type; // keyboard or null depending on how the value was changed.
});
                        
Try it: Bind to the change event by type:jqxMaskedInput
valueChanged Event

This event is triggered when the value is changed.

Code examples

Bind to the valueChanged event by type: jqxMaskedInput.


$('#jqxMaskedInput').on('valueChanged',
function () 
{
    var value = event.args.value;
    var text = event.args.text;
});
                        
Try it: Bind to the valueChanged event by type:jqxMaskedInput

Methods

clear Method

Clears the value.

Parameter Type Description
None
Return Value
None

Code examples

Invoke the clear method.

$('#jqxMaskedInput').jqxMaskedInput('clear'); 
Try it: clears the jqxMaskedInput
destroy Method

Destroys the widget.

Parameter Type Description
None
Return Value
None

Code examples

Invoke the destroy method.

$('#jqxMaskedInput').jqxMaskedInput('destroy'); 
Try it: destroys the jqxMaskedInput
focus Method

Focuses the widget.

Parameter Type Description
None
Return Value
None

Code examples

Invoke the focus method.

$('#jqxMaskedInput').jqxMaskedInput('focus'); 
Try it: focuses the jqxMaskedInput
val Method

Sets or gets the value.

Parameter Type Description
value String
Return Value
String

Code examples

Get the value using the val method.

var value = $('#jqxMaskedInput').jqxMaskedInput('val');

// Get the value using jQuery's val.
var value = $('#jqxMaskedInput').val();

Set the value using the val method.

$('#jqxMaskedInput').jqxMaskedInput('val', 1242);

// Set the value using jQuery's val.
$('#jqxMaskedInput').val(1242);
Try it: sets the value of the jqxMaskedInput