Restrict user input to only numbers in easyui $.messager.prompt

(1/1)

jahangir:
How do I restrict user input to only numbers in easyui $.messager.prompt

jarry:
Please try this code.
Code:

var msg = $.messager.prompt('My Title', 'Please type something', function(r){
if (r){
alert('you type: '+r);
}
});
msg.find('.messager-input').attr('type','number')

jahangir:
Thanks Jarry, it works.
I changed your code from:
msg.find('.messager-input').attr('type','number');
to:
msg.find('.messager-input').numberbox({width:'100%'});
to convert the input to an EasyUI numberbox.

Navigation

[0] Message Index