?
This document uses PHP Chinese website manual Release
將一組元素轉換成其他數(shù)組(不論是否是元素數(shù)組)
你可以用這個函數(shù)來建立一個列表,不論是值、屬性還是CSS樣式,或者其他特別形式。這都可以用'$.map()'來方便的建立。
給每個元素執(zhí)行的函數(shù)
把form中的每個input元素的值建立一個列表。
<p><b>Values: </b></p> <form> <input type="text" name="name" value="John"/> <input type="text" name="password" value="password"/> <input type="text" name="url" value="http://ejohn.org/"/> </form>
$("p").append( $("input").map(function(){ return $(this).val(); }).get().join(", ") );
[ <p>John, password, http://ejohn.org/</p> ]