i'm struck with a problem i have a big project having global css
with this css
i want to place icon
to every autocomplete
so that it gives clue to users
it should something look like below one:
.icon:before{
position: relative;
content: "V";
color: red;
right: 17px;
}
<div>
<label for="tags">Search: </label>
<input class="tags">
<span class="icon"></span>
</div>
Note: <span class="icon"></span>
which i cannot inject to every autocomplete
globally with javascript or jquery. with css
only i have to achieve desired result
below is my sample elements to achieve above desired result:
JSFIddle:http://jsfiddle.net/cS2bL/66/ (Working)
$(function() {
var availableTags = [
"john",
"khair",
"compton",
"Jordan",
"Micheal",
"Peter"
];
$( ".tags" ).autocomplete({
source: availableTags
});
});
.ui-widget{
margin-top: 20px;
}
.float-right{
float: right;
}
.float-left{
float: left;
}
.icon:before{
position: relative;
content: "V";
color: red;
right: 17px;
}
/* tried for below element */
.ui-autocomplete-input:after{
position: absolute;
content: 'V';
color:red;
}
/* tried for above element */
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet"/>
<div class="ui-widget">
<label for="tags">Search: </label>
<input class="tags">
</div>
<div class="ui-widget">
<label for="tags">Search: </label>
<input class="tags" style="width:130px;">
</div>
<div class="ui-widget">
<label for="tags">Search: </label>
<input class="tags" style="width:140px;">
<label for="tags">Search: </label>
<input class="tags" style="width:100px;">
</div>
<div class="floated-elements ui-widget">
<div class="float-right">
<label for="tags">Search: </label>
<input class="tags" style="width:300px;">
</div>
<div class="float-left">
<label for="tags">Search: </label>
<input class="tags" style="width:50px;">
</div>
</div>
Please help me thanks in advance!!