Jquery.map (Array, callback (Elementofarray, Indexinarray))
It seems to be similar to the Python map method, except that the parameter order is different.
The map method in Python is this definition of map (function, iterable, ...) that can receive multiple iterations
Example
The code is as follows |
Copy Code |
<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://www.111cn.net/"/> </form> <script type= "Text/javascript" src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></ Script> <script> $ ("P"). Append ($ ("input"). Map (function () { return $ (this). Val (); }). Get (). Join (",")); </script> $ ("input"). Map (function () { return $ (this). Val (); }). get ();
|
can produce an array
. Join (",") is an array, divided into strings