ComboBox Disabled

2

Good morning, I would like to know if you could help me with the following, I currently have a combobox with a property disabled

I would like to know if there is any way to remove that red circle that comes out there, and replace it instead with a pop up of the combo information, thank you very much

Deputy code

{
  "mDataProp": "Fecha_Vencimiento", "sTitle": "Vencimiento", "orderable": true, "sWidth": "28%",
  render: function (data, type, row) {
    var stringOptions = "";
    $.each(row.TL_Lista_Fecha_Punto, function (key, value) {
      stringOptions += "<option data-inicio-type=" + lfConvertirFecha(value.TF_Fecha_Inicio) + " value='" + lfConvertirFecha(value.TF_Fecha_Punto) + "'>" + lfConvertirFecha(value.TF_Fecha_Punto) + "</option>";
      //stringOptions += "<option value='" + ConvertidorFechasMVC(ConvertirFechaFormato(new Date(ConvertirFechaJSON(value.TF_Fecha_Punto, "dd/mm/YYYY")), "dd/mm/YYYY")) + "'>" + ConvertidorFechasMVC(ConvertirFechaFormato(new Date(ConvertirFechaJSON(value.TF_Fecha_Punto, "dd/mm/YYYY")), "dd/mm/YYYY")) + "</option>";
    });
    return '<select id="lstPunto" class="combo"  data-none-results-text="No se encontraron coincidencias." disabled>' + stringOptions + '</select>';
  },
},
    
asked by Mauricio Acon 05.07.2017 в 19:21
source

2 answers

0

Do not disable the select, but you can not manipulate it. In the following example, what I do is add a click() to the select and disable the options that I do not want to show. At the time you want to use that select, all you have to do is remove the function and enable the options (and remove the first). Everything with jQuery.

  $('#selectBox').click(function() {
    alert( "No puedes seleccionar ninguna de estas opciones." );
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
</head>

<body>

<select id="selectBox">
<option value="1">DESHABILITADO</option>
<option value="1" hidden>Option #1</option>
<option value="2" hidden>Option #2</option>

</select>

</body>
</html>
    
answered by 06.07.2017 в 10:33
0

First you can hide the disabled cursor with css

#selectBox:hover {
   cursor: default;
}

As I see a jQuery foreach, you can easily add an alert explaining the disabled

  $('#selectBox').click(function() {
    alert( "Campo Bloqueado" );
  });

But with javascript serious

document.getElementById("selectBox").addEventListener("click", alert( "Campo Bloqueado" ));
    
answered by 06.07.2017 в 11:00