My PHP item got rejected for not using JS properly.


My item for soft rejected due to this-

Use on(); rather than .click(), .bind(), .hover(), .submit(), etc.

I don’t know what caused this error.

Is this the reason? How to fix if yes?


For best performance and concise code use event delegation whenever possible:

Also you should to transfer all js code to the main js file.


To answer your specific question: no, there’s nothing wrong with the code in your screenshot. Submitting a form with .submit() is standard and acceptable.

There must be other parts of your code where you’re using jQuery’s event helper methods (like $().click() instead of $().on('click')) – these are what will cause your rejection.

In jQuery, submit() acts both as a method to submit a form (if you don’t pass an argument), and as an event that is triggered when a form is submitted (if you pass a function argument). Submitting a form with it is fine, but in your screenshot you’re not even using jQuery so it’s definitely fine. :slight_smile:

@mgscoder @baileyherbert

Thank you for the help!

1 Like