星期六, 8月 07, 2010

[jQuery API] Jquery select 操作

without using any extra plugins, 
var myOptions = {
    val1 : 'text1',
    val2 : 'text2'
};
 
$.each(myOptions, function(val, text) {
    $('#mySelect').append(
        $('<option></option>').val(val).html(text)
    );
}); 
 
Reference:
jQuery對select的操作(魚乾筆記本)
 

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails