Message from JavaScript discussions

November 2020

— This is my login page nothing wrong because my code can find the form


This is my register page and here it can't find the form so I get a error, this is because both are in the same js file

— So how can I make it so I have 2 of those functions in the same file but it only uses the right function on each page

Message permanent page

— That's why I asked is it bad practice to use both submit functions in 1 file

— If( === 'yourAction') do what you have to do (?)

— Cause I know how to do this but I think when I put this code in a function and call it like this <script src="main.js">loginSubmit();</script> i think its bad practice right?

Message permanent page

— No this is not what I mean

— I have this script in 1 js file and the js file is called in the register page and the login page but it can't find the form on the registerpage

Message permanent page

— So I get an error

— Bad practice is, for example when you use jquery (old approach instead of new), in your case seems everything is screwed🤤

Message permanent page

— I i'm forced to use jquery at work xD

— Bad practice man!