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
classNameinbootboxwhich you can use to addclassand once you addclasstry setting itsmaxlengthas below:Once this is initialized you can add
maxlengthattribute ondocument.readyUPDATE
Remove
classNameduring initialization and add below code once initialized