0

I was making my HTML and suddenly my button wouldn't work

<button class="button.hover:links" formaction="Link here">Next</button>

So how to make it work because ever since yesterday it wouldn't work

YT_Xaos
  • 335
  • 4
  • 19

2 Answers2

3

First I am not sure why you chose the formaction attribute as the destination URL to link there.

The button with the formaction attribute should be working inside <form> tag.

The formaction attribute specifies where to send the form-data when a form is submitted.

The formaction attribute is only used for buttons with type="submit".

If you want a button which link to a URL you should make a button inside the <a> tag.

<a href="your URL"> <button class="your class">HTML here</button> </>

Second, it doesn’t make sense you put a class name as a CSS recognizable string.

You should define CSS independently and import that to use. Or you can use style attribute to set inline CSS.

import "index.css"
<button class="myclass">
...

File index.css

button.myclass:hover{
    // Your style
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

If you want to link something to a button, you can do something like this:

<a href="INSERT LINK HERE">
    <button class="button.hover:links" formaction="HTML here">Next</button>
</a>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sanlyn
  • 139
  • 1
  • 12