Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can you use the 'action' attribute for a 'div' element?

My question is quite straight forward and simple. I am learning node JS and I know that the ‘form’ element has a ‘action’ attribute. I just want to know if even a div element has such an attribute…

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

No, action attribute only works for form tag.
If you want to perform same as action does in form, you can use <a href="https://www.websiteurl.com">Wrap div with this</a>.
If you want to pass dynamic values like form you can provide in herf followed by url/?id=5.
You can also do it by using javascript by providing id to div

onClick="location.href='url-here'"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading