Sagar Grover
Sagar Grover

Reputation: 51

Webpage not working

I have added 31 buttons on web page and 30 of them are either "Yes" or "No" or "NO Clue"and last is "Submit". I have used jquery functions such that "NO" and "NO Clue" fades out on clicking "YES" and viceversa. But since my input type = "submit" for all, my jquery is not working as the page reloads after clicking the very first button. Any suggestions on how to implement this ? I am a noob so please go easy on me.

Upvotes: 0

Views: 83

Answers (3)

user3559349
user3559349

Reputation:

Make your "yes/no/no clue" buttons html buttons elements

<button type="button">No</button>

Upvotes: 4

bnp887
bnp887

Reputation: 5746

Try changing the buttons like so:

<button type="button">Yes</button>
<button type="button">No</button>
<button type="button">No Clue</button>
<!-- include the rest of the buttons here -->
<input type="submit" value="Submit!">

The buttons are elements on the page which can be clicked, whereas the submit input element type will try to 'submit' (or send) the values of elements back to the server.

Upvotes: 2

undefined
undefined

Reputation: 2101

If the "Yes", "No" and "No Clue" buttons have a submit type then they will submit the form and the page would be reloaded. Try using a button type for them.

Upvotes: 0

Related Questions