code_prettify

2014年3月19日 星期三

jquery 五種取 selected text的方法

console.log($('select[name="leave_type_auto_id"] option:selected').text());
console.log($('select[name="leave_type_auto_id"] option').filter(':selected').text());// optimized(maybe)
console.log($('select[name="leave_type_auto_id"]').children().filter(':selected').text());
console.log($('select[name="leave_type_auto_id"]').children('option').filter(':selected').text());// fastest(maybe)
console.log($('select[name="leave_type_auto_id"]').children('option:selected').text());
console.log($('select[name="leave_type_auto_id"]').children(':selected').text());// fastest(maybe)
有篇比較各種 selector速度的測試
http://jsperf.com/get-selected-option-text

2014年3月12日 星期三

懶得寫 bean. java內建的 key value paire.

java.util.AbstractMap.SimpleEntry<K, V>(K, V).
腦袋一下轉不過來,一直無法建構
new java.util.AbstractMap.SimpleEntry<Integer, String>(new Integer(1), "foo");