我的jQuery不会使用.css()函数更改fontcolor

sun*_*ngh 1 css jquery

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <script>
  $(document).ready(function () {
      $('h3').hover(function() {
          $('h3').css({"color","#OOFFFF"});
      });
  });
  </script>
Run Code Online (Sandbox Code Playgroud)

这是我的代码,放在我的HTML文档的末尾,在结束之前<body>.h3当我将鼠标悬停在它上面时,我正试图让我的标签将其颜色更改为浅蓝色.这不适用于我的HTML:

<h3 class="masthead-brand">sunil singh</h3>
Run Code Online (Sandbox Code Playgroud)

谁能告诉我什么是错的?我真的很感激.

und*_*ned 6

您的代码中存在语法错误,缺失:.你是混淆method('prop', 'value')method({ prop: 'value' })语法.此外,您使用的是O("Oh")而不是0(零)."Oh"不是十六进制值.

  $('h3').hover(function() {
      // `this` here refers to the hovered element 
      $(this).css({"color": "#00FFFF"});
  });
Run Code Online (Sandbox Code Playgroud)