function disableButton(id) {
    document.querySelector(id).onkeyup = () => {

        let channelInput = document.querySelector('#channelInput').value;
        let channelItem = document.querySelector('#channelItem').value;

        // Remove the spaces to prevent an only whitespace input
        channelInput = channelInput.replace(/\s+/g, '');
        channelItem = channelItem.replace(/\s+/g, '');

        console.log("is enabled: " + (channelInput.length > 0 && channelItem.length > 0))
        if (channelInput.length > 0 && channelItem.length > 0) {
            document.querySelector('#channelSubmit').disabled = false;
        } else {
            document.querySelector('#channelSubmit').disabled = true;
        }
    }

}
// Function that disables a specific button. The id is the USER INPUT and not the button's id
Function that disables a specific button. The id is the USER INPUT and not the button's id
Function that disables a specific button . The id is the USER INPUT and not the button ' s id
function disableButton(id) {
    document.querySelector(id).onkeyup = () => {
        let channelInput = document.querySelector('#channelInput').value;
        let channelItem = document.querySelector('#channelItem').value;
        channelInput = channelInput.replace(/\s+/g, '');
        channelItem = channelItem.replace(/\s+/g, '');
        console.log("is enabled: " + (channelInput.length > 0 && channelItem.length > 0))
        if (channelInput.length > 0 && channelItem.length > 0) {
            document.querySelector('#channelSubmit').disabled = false;
        } else {
            document.querySelector('#channelSubmit').disabled = true;
        }
    }
}
function disableButton ( id ) { document . querySelector ( id ) . onkeyup = ( ) => { let channelInput = document . querySelector ( '#channelInput' ) . value ; let channelItem = document . querySelector ( '#channelItem' ) . value ; channelInput = channelInput . replace ( / \s+ / g , '' ) ; channelItem = channelItem . replace ( / \s+ / g , '' ) ; console . log ( "is enabled: " + ( channelInput . length > 0 && channelItem . length > 0 ) ) if ( channelInput . length > 0 && channelItem . length > 0 ) { document . querySelector ( '#channelSubmit' ) . disabled = false ; } else { document . querySelector ( '#channelSubmit' ) . disabled = true ; } } }
Function that disables a specific button.
Function that disables a specific button .
// Remove the spaces to prevent an only whitespace input