Greetings, I have a select
which is disabled with the attribute readonly
, what I want is to prevent it from opening while it is with readonly
, this achievement in this code
if ($(this).is('[readonly]')) {
$(this).blur()
}
but this opens and closes the select
, this is what I want to avoid.
Any idea of how it could be?
EDITO
This element must be enabled when double clicking on this, so I do not use disabled, this is already done.
pd : I use botstrap and when I'm with readonly
I take a disabled style
$(document).ready(documentoListo)
function documentoListo() {
$("body").on("click",".drop",function(e){
if ($(this).is('[readonly]')) {
//e.preventDefault()
$(this).blur()
}
})
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="escolaridad" class="form-control reset inputt drop" readonly="readonly"><option value="0">Seleccione escolaridad</option><option value="1">Básica incompleta</option><option value="2">Básica completa</option><option value="3">Educación Media incompleta</option><option value="4">Educación Media completa</option><option value="5">Técnico nivel medio</option><option value="6">Técnico nivel superior</option><option value="7">Técnico profesional universitario</option><option value="8">Profesional universitario</option></select>