Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.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/1/database/9.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
Javascript 使用selected.js,如何将图像添加到下拉项?_Javascript_Jquery Chosen - Fatal编程技术网

Javascript 使用selected.js,如何将图像添加到下拉项?

Javascript 使用selected.js,如何将图像添加到下拉项?,javascript,jquery-chosen,Javascript,Jquery Chosen,使用selected.js,如何将图像添加到下拉列表项中?通过在selected的列表项上设置背景图像: .chzn结果li{ 背景:url('path/to/img.png')无重复3px中心; 左侧填充:12px; } 相应地调整像素计数。要完成Joseph(我无法对他的答案添加注释),该类已更改,因为未知版本: 下面是v1.0.0中正确的css: li.active-result { background: url('path/to/img.png') no-repeat 3px

使用selected.js,如何将图像添加到下拉列表项中?

通过在selected的列表项上设置
背景图像

.chzn结果li{
背景:url('path/to/img.png')无重复3px中心;
左侧填充:12px;
}
相应地调整像素计数。

要完成Joseph(我无法对他的答案添加注释),该类已更改,因为未知版本: 下面是v1.0.0中正确的css:

li.active-result {
    background: url('path/to/img.png') no-repeat 3px center;
    text-indent:2em;
}

约瑟夫先生

解决方案:CSS规则应该是
background
而不是
background image