Can't understand 'action' element in forms

What is the function of the ‘action’ element? Is it a separate tag than ‘form’ tag? How else can I use it? Does it have a singular function which is defined by the tag I am using it in? Can anyone please explain what ‘action’ can do in html. Any help will be appreciated.

  **Your code so far**

<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action = "https://www.freecatphotoapp.com/submit-cat-photo">
<input type="text" placeholder="cat photo URL">
</form>
</main>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53

Challenge: Create a Form Element

Link to the challenge:

‘action’ in form element specifies where to send the data entered by the user in the form.

It generally is a URL pointed to another website or cloud or database link which stores data.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.