There is a code:
jQuery('document').ready(function() { $("button").click(function() { if ($(".sent_1") == "right") { $(".sent_1").animate({ color: 'red' }); } if ($(".sent_2") == "wrong") { $(".sent_2").animate({ color: 'red' }); } if ($(".sent_3") == "wrong") { $(".sent_3").animate({ color: 'red' }); } }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="styles.css"> <script type="text/javascript" src="/jquery-3.0.0.min.js"></script> <script type="text/javascript" src="/textcolors.js"></script> <meta charset="utf-8" http-equiv="ContentType" content="text/html"> <title>Выполните задания</title> </head> <body> <form method="POST" action="textcolors.js"> <div class="exercise_sentences"> <label for='first' class="sent_1">first(+)</label> <input type="text" name="fi"> <label for='second' class="sent_2">second(-)</label> <input type="text" name="se"> <label for='third' class="sent_3">third(-)</label> <input type="text" name="th"> <input class="button" type="submit" name="check" value="Проверить"> </div> </form> </body> </html> When I press a button, I want the text to glow green when the answer is correct and red when not answered correctly. When I press a button, it simply gives the text exactly the same as in textcolors.js, instead of performing it. (I connected jQuery by copy-paste in jquery-3.0.0.min.js according to the version.) At least I need to know what is wrong?
if ($(".sent_1") == "right")what are you checking here? What do you compare with? Why writeaction="textcolors.js"in the form tag? - Misha Saidov