Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery搜索输入焦点()函数_Jquery_Css_Onfocus - Fatal编程技术网

使用jQuery搜索输入焦点()函数

使用jQuery搜索输入焦点()函数,jquery,css,onfocus,Jquery,Css,Onfocus,我想做一个搜索框,当用户在输入字段的重点,提交按钮的背景将改变。请你帮我做这个。先谢谢你。 $(文档).ready(函数(){ $(“输入#bigsboxh”).focus(函数(){ $(“submit#bigsboxhsub”).css({“背景色”:“#137ff3”,“不透明度”:“1”); }); }); 您可以使用css实现这一点 请参阅代码片段 #bigsboxh:focus+#bigsboxhsub{ 背景:红色; } 提交 您有不必要的引号“137ff3”“ 只使用id

我想做一个搜索框,当用户在输入字段的重点,提交按钮的背景将改变。请你帮我做这个。先谢谢你。

$(文档).ready(函数(){
$(“输入#bigsboxh”).focus(函数(){
$(“submit#bigsboxhsub”).css({“背景色”:“#137ff3”,“不透明度”:“1”);
});
});

您可以使用css实现这一点

请参阅代码片段

#bigsboxh:focus+#bigsboxhsub{
背景:红色;
}

提交
  • 您有不必要的引号
    “137ff3”“
  • 只使用
    id
    ,不要同时使用标记名
    $(“#bigsboxh”)
  • $(文档).ready(函数(){
    $(“#bigsboxh”).focus(函数(){
    $(“#bigsboxhsub”).css({“背景色”:“#137ff3”,“不透明度”:“1”);
    });
    });
    
    
    
    请尝试添加额外的引号“137ff3”

    不要使用
    $(“输入”
    $(“提交”
    只使用id的
    $(“#bigsboxh”)
    $(“提交”

    $(文档).ready(函数(){
    $(“#bigsboxh”).focus(函数(){
    $(“#bigsboxhsub”).css({“背景色”:“#137ff3”,“不透明度”:1});
    });
    });
    
    搜索
    尝试下面的代码

    $("#bigsboxh").focus(function(){
           $("#bigsboxhsub").css('background-color', '#137ff3');
    
      }).blur(function(){
           $("#bigsboxhsub").css('background-color', 'FFFFFF');
      });