I am using jQuery alertify prompt http://alertifyjs.com/prompt.html
Is there any way to make textbox mandatory by defining attributes directly?
Thanks
I am using jQuery alertify prompt http://alertifyjs.com/prompt.html
Is there any way to make textbox mandatory by defining attributes directly?
Thanks
You can get a reference to the input box using elements
property:
alertify.prompt().set('onshow',function(){
$(this.elements.content).find('.ajs-input').attr('required', true);
});
But this will not prevent the dialog from closing when you press OK, to prevent that you need to check the value parameter and cancel the close event if it's empty:
alertify.prompt('Input required')
.set('onok', function(e, value){
if(!value) e.cancel = true;
});