To maintain the state of the checkboxes following a regular form submit event you need some mechanism for storing the relevant checkbox states. There are several client-side methods that you can choose from such as cookies, local/session Storage, indexedDB or Web SQL though the simplest to use is probably localStorage
The following has assigned a dataset attribute to each of the parent DIV elements. This data-id attribute could be numeric or string - the value will be used as a key in the localStorage object. Externally registered event listeners for all checkboxes will add the checkbox parent id to the store which can be easily read when the page is reloaded - thus the state can be restored.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title></title>
</head>
<body>
<form method='post'>
<div data-id=1>
<input type='checkbox' />
<span class='text-white'>Filter</span>
<input name='Filter' disabled />
</div>
<div data-id=2>
<input type='checkbox' />
<span class='text-white'>Filter</span>
<input name='Filter' disabled />
</div>
<div data-id=3>
<input type='checkbox' />
<span class='text-white'>Filter</span>
<input name='Filter' disabled />
</div>
<div data-id='geronimo'>
<input type='checkbox' />
<span class='text-white'>Filter</span>
<input name='Filter' disabled />
</div>
<input type='submit' />
</form>
<script>
const _STORE='wigwam-banana-teapot-jellyfish'; // Whatever you wish to call your storage
document.querySelectorAll('input[type="checkbox"]').forEach( chk=>chk.addEventListener('click',function(e){
/*
set the text field disabled state based upon
whether or not the checkbox is ticked.
*/
this.parentNode.querySelector('input[name="Filter"]').disabled=!this.checked;
/*
Add the data-id of the parent div to
localStorage
*/
let json=localStorage.getItem( _STORE )!=null ? JSON.parse( localStorage.getItem( _STORE ) ) : {};
json[ this.parentNode.dataset.id ]=this.checked;
localStorage.setItem( _STORE, JSON.stringify( json ) );
}));
//reload checkbox states on page load...
if( localStorage.getItem( _STORE )!=null ){
// get the stored data...
let json=JSON.parse( localStorage.getItem( _STORE ) );
// process each item in stored data
Object.keys( json ).forEach( id=>{
if( json[ id ]==true ){
// if there is a matching DOM element with this data-id
// set the checkbox state and enable the textfield.
let div=document.querySelector('div[ data-id="'+id+'" ]')
div.querySelector('input[type="checkbox"]').checked=true;
div.querySelector('input[name="Filter"]').disabled=false;
}
})
}
</script>
</body>
</html>