I want to customize bootbox prompt
input box. I want add clsss
attribute in input
element.
I try this code
bootbox.prompt({
title: 'Enter Mobile Number',
placeholder: '8801XXXXXXXXX',
buttons: {
confirm: {
label: 'Submit'
}
},
callback: function(value) {
console.log(value);
})
});
I want to something like that
bootbox.prompt({
title: 'Enter Mobile Number',
placeholder: '8801XXXXXXXXX',
class: 'only-number',
buttons: {
confirm: {
label: 'Submit'
}
},
callback: function(value) {
console.log(value);
})
});
Update
As per Guruprasad Rao answer I update my code. But class attribute add in div
element not in input
element.
bootbox.prompt({
title: 'Enter Mobile Number',
placeholder: '8801XXXXXXXXX',
className: 'only-number',
buttons: {
confirm: {
label: 'Submit'
}
},
callback: function(value) {
console.log(value);
})
});
See my inspect element pic
Well there is an option called
className
inbootbox
which you can use to addclass
and once you addclass
try setting itsmaxlength
as below:Once this is initialized you can add
maxlength
attribute ondocument.ready
UPDATE
Remove
className
during initialization and add below code once initialized