Hide Button with empty field

I have a submit button that I would like to hide until validations has validated fields are not empty. I know through JS that I can write function as

$(document).ready(function() {

if(!$('input').val()){
    $('#button').hide();
}
else {
    $('button').show();
}
});

How do I accomplish this through dynamic attributes? 

Hi,
lets say that you have a forrm with two inputs.
One with id=one
The other with id=two

To hide the button just add this inside the button tag
dmx-show="one.value!='' || two.value=''"

Hope it helps.
Thank you!

Thanks brov that was perfect.

1 Like