0
I don’t know what I’m doing wrong, maybe I can even be simple, but it doesn’t give me the expected result
When 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:
But what problem occurs? Does not run? Some error msg appears in the console?
– Diego Marques
Within the stretch had put up an Alert and does not perform, I do not know why... next to the dropdow was to fill in the company name... just to show the selected company..
– Ulisses Gimenes
and nothing happens
– Ulisses Gimenes
The snippet is the correct form the variables, the array and everything? I passed this way in onclick="guardaIdSplit({$e->id.":". $e->name}})"
– Ulisses Gimenes
When I click on the house I choose a company in the list and it should change where is microsoft for the selected company!!
– Ulisses Gimenes