开发者

What is wrong with this jquery?

开发者 https://www.devze.com 2023-03-03 06:47 出处:网络
Here is some jQuery I have coded: $(function () { $(\'input\').click(function() { $(this).css(\"background\", \"-webkit-gradient(linear,left top,left bottom,from(white),to(#DDD))\");

Here is some jQuery I have coded:

$(function () {

$('input').click(function() {

$(this).css("background", "-webkit-gradient(linear,left top,left bottom,from(white),to(#DDD))");

)};

)};

I am getting a console err开发者_如何学JAVAor of syntax error at the first )};. I will probably bang my head against the wall for the next hour because I missed some ridiculously simple bug... but O well thats better than doing that and not finding the bug.


$(function () {

$('input').click(function() {

  $(this).css("background", "-webkit-gradient(linear,left top,left bottom,from(white),to(#DDD))");

});

});

You had the parenthesis and curly braces reversed on the last 2 lines!


There are two syntax errors:

  1. Change this )}; to this });, in last row
  2. Change this )}; to this });, in pre-last row

:)

0

精彩评论

暂无评论...
验证码 换一张
取 消