MOSTRAR DATO DE TEXTO SELECT OPTION EN PROPIEDAD VALUE Y TEXT
1. Selecting the existing selected option and modifying its value and text: JavaScript $(document).ready(function() { $("#mostrarDato").click(function() { const nuevoValor = "aquivatexto"; const nuevoTexto = "Nuevo texto"; // Get the currently selected option const selectedOption = $("#miSelect option:selected"); // Modify its value and text selectedOption.val(nuevoValor).text(nuevoTexto); }); }); Usa el código con precaución. Here, clicking the button with the ID "mostrarDato" triggers the function. It defines the new value (nuevoValor) and new text (nuevoTexto) you want to set. Then, it selects the currently selected option using $("#miSelect option:selected") and applies the val() and text() methods with the desired values. 2. Creating a new option with selected, value, and text: JavaScript $(document).ready(function() { $("#mostrarDato").click(function() { co...