jquery get all value on select option

By Adminpmd 22 Mei 2026, 09:55:13 WIB | 👁 294 Pemerintah Daerah

To get the text and value of the selected option and all other options of a <select> element, you can use the following code:

// Get value

var selValue = $('#selectElementId').val();

// Get text

var selText = $("#selectElementId option:selected").text();

// Get all values

var allValues = $('#selectElementId option').map(function() {

return $(this).val();

}).get();

// Get all texts

var allTexts = $('#selectElementId option').map(function(){

return $(this).text();

}).get();


Baca Artikel Lainnya :

  1. form
  2. Topic: Inspektorat Lumajang Time: May 21, 2025 19:00 PM Jakarta Join Zoom Meeting https://us06web.zoom.us/j/89047096227?pwd=DghECDntZbWDYZMOYnIB4ZvPsbBwyN.1 Meeting ID: 890 4709 6227 Passcode: 1234567890
  3. 082142634989
  4. https://forms.gle/BBPzpv5YgVeLHuds8
  5. Berikan ringkasan dari materi² berikut


View all comments

Write a comment

Kanan - Iklan Sidebar