Required attribute is not working for me what should I do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Required attribute is not working for me what should I do?

Guys the 'required' attribute is not working for me i a html form with JavaScript. But when I removed JavaScript it is work perfectly. What should I do for fix the issue. Here my code please check. ( https://code.sololearn.com/WDT5fau0EXpY/?ref=app. )

1st Oct 2019, 8:35 AM
Rupendra Singh
Rupendra Singh - avatar
7 Answers
+ 1
It's still work. But had been hide by js. Try this and you will see: $(document).ready(function () { $("#submit").on("click", function () { //$("#form").fadeOut(); old = $("#wlcm").html(); $("#wlcm").html(old + "Hello " + $("#name").val() + "<br> Thanks for signing up!"); }); });
1st Oct 2019, 10:02 AM
Thống Nguyễn
Thống Nguyễn - avatar
+ 1
Ya!! Thanks for help 👍
1st Oct 2019, 11:03 AM
Rupendra Singh
Rupendra Singh - avatar
+ 1
I have a simple ex here, take alook! https://code.sololearn.com/WSlV8163h2x0/?ref=app
1st Oct 2019, 5:24 PM
Thống Nguyễn
Thống Nguyễn - avatar
0
You nees to code check and make sure all of require field funtion before hide the form and say thank you!
1st Oct 2019, 10:04 AM
Thống Nguyễn
Thống Nguyễn - avatar
0
Thanks for your help but still some issues here I have updated my code with your JavaScript, after first click it show output 'hey ....Thank you..' and then go back to name input field
1st Oct 2019, 10:24 AM
Rupendra Singh
Rupendra Singh - avatar
0
Yes, my modified script just don't hide the form so you can see it's still work. But don't really fix and finish the work for you.
1st Oct 2019, 10:28 AM
Thống Nguyễn
Thống Nguyễn - avatar
0
To go futher in the code way you need learn how to do that your self!
1st Oct 2019, 10:29 AM
Thống Nguyễn
Thống Nguyễn - avatar