show hide div based on input field

I am trying to make a simple quiz with just one question, I have got to the stage where if the correct answer is typed in then a "correct" message is shown, my problem is I also want to have an "incorrect" message display for 1 second then fade out if anything else is typed in the input field. I dont really know how to get both functions to happen, here is what I have so far

What is 10 x 2 ?

That's Correct!
Sorry, Try again!
​ $(document).ready(function(){ $("#buttontest").click(function(){ if ($('#full_day').val() == 20) { $("#correct").show("fast"); //Slide Down Effect } else { $("#correct").hide("fast"); //Slide Up Effect } }); });​
thanks for everybody suggestions, I have learnt quite a bit

以上就是show hide div based on input field的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准