【问题标题】:jquery transparent background in the drop down in the autocomplete menujquery透明背景在自动完成菜单的下拉菜单中
【发布时间】:2021-07-22 12:56:37
【问题描述】:

我有这段代码,但是下拉菜单不透明,看起来很乱

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js">
    </script>

    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js">
    </script>

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css"
        rel="stylesheet" type="text/css" />


</head>
<body>

<form action = "https://www.coinoracle.net/results" method = "POST">
<input type="text" name="the_coins" id="tags">
<input type="submit" value="Coin Divination">


</form>


    <script>
  $( function() {
    var availableTags = [
        {% for my_coins in my_coins %}
            "{{my_coins}}",
        {% endfor %}
    ];
    $( "#tags" ).autocomplete({
      source: availableTags

    });
  } );
  </script>

效果很好,但下拉菜单的背景现在是透明的,并且与页面中 中的其他文本重叠,有没有一种简单的方法可以使它变成纯白色以保持可读性?可能不添加 css 文件或其他操作,我可以在 html 页面上的代码中执行此操作吗? 不幸的是,我对 javascript 了解不多...

【问题讨论】:

    标签: javascript html jquery jquery-ui-autocomplete


    【解决方案1】:

    答案就是在 html 中添加这个,它进入到里面 像这样,您可以将自动完成的背景设置为您想要的任何颜色

    <style>
    
    
         .ui-autocomplete.ui-menu.ui-widget.ui-widget-content{background-color: yellow;}
    
    
    </style>
    
    

    希望对我这样的人有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-27
      • 2016-10-01
      相关资源
      最近更新 更多