Jquery Tips & Tricks
October 29th, 2009
No comments
Start from now on, I will dedicate this page to update any relevant tips and tricks relate with jquery
Start from now on, I will dedicate this page to update any relevant tips and tricks relate with jquery
Jquery, salah satu javascript library terpopuler saat ini, mempunyai cara mudah untuk mendapatkan text dan value dari dropdown list. Tidak lebih dari 2 baris.
Asumsi anda mempunyai code dibawah ini
Cara untuk mendapatkan text dan valuenya sangat mudah, yaitu
var value = $("#selection").val(); /** mendapatkan value **/
var text = $("#selection option:select").val(); /** mendapatkan text **/
Maka dengan javascript diatas, hasilnya adalah “2″ (value) dan “Mama” (text). Mudah bukan
Recent Comments