I do not know what I'm doing wrong, maybe it can be simple, but it does not give me the expected result.
In creating the html component:
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-university"></i>
<span class="label label-warning">{{count($empresas)}}</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você pode emitir recibo para {{count($empresas)}} empresas</li>
<li>
<ul class="menu">
@foreach($empresas as $e)
<li><!-- start notification -->
<a name="itemlista" id="{{$e->id}}"
onclick="guardaIdSplit({{$e->id.":".$e->name}})" href="#">
<i class="fa fa-industry text-aqua"></i> {{$e->name}}
</a>
</li><!-- end notification -->
@endforeach
</ul>
</li>
</ul>
</li>
In the script:
function guardaIdSplit(empresa) {
var newArray = empresa.split(":");
var id = newArray[0];
var name = newArray[1];
$("[name=itemlista]").removeClass("text-green");
$("[name=itemlista]").addClass("text-black");
window.localStorage.setItem('emitente_id', id);
$("#" + id).removeClass("text-aqua");
$("#" + id).addClass("text-green");
$("#emitenteSelect").text(""+name);
}
It should be close to this image: