2

What does it mean for action="#" in the html form tag. For example,

<form action="#" method="post" class="demoForm" id="demoForm">

    <fieldset>
        <legend>Demo: Checkboxes Sharing Same Name</legend>

    <p>Check the types of sports or fitness activities you engage in on a regular basis.</p>

    <p>
        <label><input type="checkbox" name="sports[]" value="cycling" /> cycling</label>
        <label><input type="checkbox" name="sports[]" value="running" /> running</label>
        <label><input type="checkbox" name="sports[]" value="other" /> other</label>
    </p>

    </fieldset>

</form>
Chonghao
  • 98
  • 1
  • 10

2 Answers2

4

'#' submits form action url to itself(your page url where the form resides). Mostly used for dummy purposes and same page form submissions, although there are better techniques out there. Have a look at this answer

what does it mean form action attribute

Community
  • 1
  • 1
Sachin Kanungo
  • 1,054
  • 9
  • 17
1

# means no outer redirection. In other words no link to another separate page. If need to refer then all should be referred only within that page itself.

in <form> tag: <form action="#"> means when click the submit button of the form don't have to redirect the collected data to any other page.

in <a> tag: <a href="#"> means when click on the link, don't redirect to any page. Just stay on the same page.

So simply in web development (in HTML) "#" means no linkage. :)

Iresha Rubasinghe
  • 913
  • 1
  • 10
  • 27