I'm trying to enable submit button only when there are 7 digits entered in the textbox.
below is the javascript I'm trying it with
require([
"jquery",
"splunkjs/mvc/simplexml/ready!"
], function($,TableView, mvc, DashboardController){
var checkAndSetEvents = function() {
if($("#user_input").length) {
$("#user_input").change(function(event){
if(event.target.value && event.target.value.length > 7) {
$(".btn.btn-primary.submit").removeAttr("disabled");
} else {
$(".btn.btn-primary.submit").attr("disabled", "disabled");
}
});
} else {
setTimeout(checkAndSetEvents, 500);
}
}
checkAndSetEvents();
});
This is the dashboard
"""
User Dashboard
<input id="user_input" type="text" token="user">
<label>Enter User Bank ID</label>
</input>
"""