I can’t read the form elements [closed]

I can’t get the values of these three fields; it only returns an empty value (a space).
The ids are correctly set in the form.

Is there a code setting error?

const data = {
  id: document.getElementById('id').value,
  nameBook: document.getElementById('namebook').value,
  priceBook: document.getElementById('pricebook').value
};