-3
I have to manipulate some fields without having access to form
.
When I am hiding the input fields, you are setting the lines of the div
, causing form
stay with holes between the lines.
My idea would be to add sequential id to these div
s to then hide.
If you have any other suggestions, you are most welcome.
Today I’m applying setAttribute
and style
all through the window.onload
:
window.onload = function(){
document.getElementById('rd-text_field-kkzqscvf').onblur = function(){validarCPF(this);}
document.getElementById('rd-text_field-kkzqscvj').setAttribute("maxlength", "10");
document.getElementById('rd-number_field-kkzqscvp').style.visibility = "hidden"
etc...
}
Hey, Matheus, thanks for the feedback. Actually I need to put ID in the DIV, because the form has several DIV all with the same class but none of them has ID. I’m checking how to resolve with this your suggestion in the stack overflow.
– Andre Figueiredo
I managed to do it through your tip. I now need to adapt to call this Function the moment I load the form. Document.getElementById('Rd-number_field-kkzh10aq'). onkeypress = Function(){this.parentElement.style.display = 'None';};
– Andre Figueiredo
I believe that in a vanilla javascript file can load a function in the creation of DOM you could do as follows:
myFunction()


document.getElementById('rd-number_field-kkzh10aq').onkeypress = myFunction()


myFunction() {this.parentElement.style.display = 'none';}
– Matheus França
I got this: var item = Document.getElementById("Rd-number_field-kkzh10aq"); Function removeLi() { item.parentNode.removeChild(item); ;}
– Andre Figueiredo
[ Solved ] Added .parentElement.style.display = 'None'; Document.getElementById('id').parentElement.style.display = 'None;';
– Andre Figueiredo