I have a registration form that when clicking on document type, if it is "RG" has a function in JS that shows a field that is defined in css as style="display: none".
But when loading from the base when doing the update page, I would like to load the page if the document type field is filled with "RG", and then activate the function to show the sender field.
I use this function to change the document type field, if you choose "RG", it shows the sender field.
<script type="text/javascript" DEFER="DEFER">
// INICIO FUNÇÃO DE MOSTRA ORGÃO EMISSOR
window.onload=function(){
document.getElementById('destypedoc').addEventListener('change', function () {
var style = this.value == 'RG' ? 'block' : 'none';
document.getElementById('hidden_div').style.display = style;
});
}
</script>