jQuery map method


jQuery “last()” method passes each element in current matched set using a function which generates new jQuery objects and returns value.


Syntax : jQuery map() method

$(selector).map(function(index,element));

index : Index of current element.
element : Current element.

jQuery map Method Example

jQuery map() Method – Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#selectAll" ).on( "click", function(event) {             
              $( "input" ).map(function(){
                $(this).attr("checked","checked");
               });
              });
              $( "#unselectAll" ).on( "click", function(event) {             
              $( "input" ).map(function(){
                $(this).removeAttr("checked");
               }); 
              });          
          });
</script>

Try it »


User Ans/Comments

📖 Read More


Advertisements