@saurabhgithb
Posted
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.
Marked as helpful
@shivaprakash-sudo
Posted
@saurabhisdev
Hello Saurabh,
That makes more sense and easy it to maintain, thank you for the suggestion. :)