Linked Questions

Popular Questions

Cannot set property type of #<HTMLTextAreaElement>

Asked by At

Uncaught TypeError: Cannot set property type of # which has only a getter

Code:

const [node] = $('input[name="train_description"]');
const attrs = {};
$.each(node.attributes, (index, attribute) => {
  attrs[attribute.name] = attribute.value;
});
console.log(attrs)
$(this).replaceWith($('<textarea>').prop(attrs));

Sorry, been out of programming for the past decade and was asked to look into this. Pulling a form from a database and need to change a text input into a textarea so it can be modified easier.

Any suggestions on the above error I am getting?

Thanks!

Related Questions