¿Cómo verificar con jquery si la selección tiene opciones y si no las tiene para deshabilitarlas y mostrar [no elementos]?
Una forma de hacerlo:
if ($('#myselect option').length == 0) { $('#myselect').hide(); }var $select = $('input:select option'); if(!$select.length ) $select.attr('disabled', true);O:
$('select:not(:has(option))').attr('disabled', true);Otra forma de hacerlo es simplemente usar la función jQuery has
if ($('#myselect').has('option').length == 0) { // Hide and disable select input here }Para obtener información sobre la función jQuery has , consulte: https://api.jquery.com/has/