3
I was wanting to run a function in Javascript when the dropdown lose focus.
I’m doing it this way, using onBlur, and it’s not working:
function DesabilitaFiltro() {
alert("ok");
}
<div class="form-group">
@Html.DropDownList("Severidade", (IEnumerable<SelectListItem>)ViewBag.Severidades, "Severidade", new { @class = "ui fluid search dropdown", style = "width: 100%", multiple = "", onchange = "Filtro()", onBlur="DesabilitaFiltro()" })
</div>
<div class="form-group">
<select class="ui fluid search dropdown" id="Severidade" multiple="" name="Severidade" onBlur="DesabilitaFiltro()" onchange="Filtro()" style="width: 100%"><option value="">Severidade</option>
<option>MEDIA</option>
<option>ALTA</option>
<option>BAIXA</option>
<option>CRITICA</option>
</select>
</div>
If anyone knows why it’s not working, help me...
What is the HTML of this?
– Leonel Sanches da Silva
tried to change the
onBlur
foronblur
? http://www.w3schools.com/jsref/event_onblur.asp– Guilherme Lautert
Have you thought about using another event? like an onclick in the front element? As @Ciganomorrisonmendez said there, post the html of this bug there for further analysis.
– Paulo Roberto
I posted the HTML...
– Italo
I’ve tried both ways @Guilhermelautert.
– Italo
Pq does not run on onchange?
– Emir Marques
@Italo here is running well, appeared the Alert so the element lost focus.
– Paulo Roberto