0

Jquery problem

i have a button ts css color is "green", and in html text is "check me". on click i want t to change to "red" & ts html txt to "checked"..then fade out within 2 sec and then to fade in, but this time i want t to reappear as before t was clicked, i have tried the codes shown below but t jumps to the last line, the second line is executed only after removing the last line. please dear ers, help me to crack t down <script> $("button").click(){ $("button").html("checked").css("color","red").show().fadeOut(2000); $("button").html("check me").css("color","green").fadeIn(1000); } </script>

25th May 2018, 7:51 PM
Kelvine De Danielo
Kelvine De Danielo - avatar
3 ответов
0
use $("button").click(function(){ ... }); oh and you forgot to close the "{" for the function
25th May 2018, 7:54 PM
Roel
Roel - avatar
0
@Roel....the parentheses are ok, am sorry i have jus shown a summary of the codes. now focus on the two lines after click function. I want both to be executed, as i have already explained, t skips the first line after the function.
26th May 2018, 3:39 AM
Kelvine De Danielo
Kelvine De Danielo - avatar
0
first, if check me is an id, use ("#checkme"), but as far as i can see, it looks like a good code. i cant find any problems
26th May 2018, 6:35 AM
Roel
Roel - avatar