H
H
heisenberg12021-06-29 22:56:44
JavaScript
heisenberg1, 2021-06-29 22:56:44

How to properly assign an action attribute to a tag?

Good day, tell me what I'm doing wrong?
I need to add the action attribute to the form tag with the address https://test.pages/example (the address does not exist, for example)

let serverUrl = 'https://test.pages/example';
let section = document.querySelector('.section ');
let form = section.querySelector('form');
form.setAttribute('action ', serverUrl );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Confy, 2021-06-29
@Confy

Maybe fix a typo?

- form.setAttribute('action ', serverUrl );
+ form.setAttribute('action', serverUrl);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question