I wish to read the value of this input field.
<input type="text" name="acadp_fields[1200]" class="text" placeholder="" value="December 26, 1969">
My code is this.
document.getElementById("acadp-upload-file-ipfs").addEventListener("click", function(event) {
event.preventDefault()
document.getElementById("acadp-upload-file-ipfs").removeAttribute("href");
document.getElementById("loading").innerHTML = '<div class="acadp-spinner"></div>';
const dateOfBirth = document.getElementById('acadp_fields[1200]').value;
...
...
But I’m getting the error below when I click the element acadp-upload-file-ipfs
Uncaught TypeError: Cannot read properties of null (reading 'value')
What am I doing wrong?
>Solution :
Try This
document.getElementsByName("acadp_fields[1200]")[0].value