@shivaprakash-sudoSubmitted about 2 years ago
Any suggestions on optimizing the JavaScript code?
Any suggestions on optimizing the JavaScript code?
Hello Shiva, I think your code can be optimized as:- a) remove separate markup for each error message instead set error message in js using a setError function. b) pass the message in setError function and use it to add innerText and styles for different error in js. c) make the div containing error message absolute and position it correctly. You can use the same for success message also. This will save use hide/unhide logic.