viernes, 7 de septiembre de 2012

Jquery Selector example


This Gets all input type=text and return a string containing a list
with the Ids and the values.
example:

Id0:500,Id1:501,Id2:502,Id3:503,Id4:504,


<script> var parameters = '';
     $('[type="text"]').each(function (index)
     {
         parameters += $(this).attr('id') + ":" + $(this).attr('value') + ',';
     });


alert( parameters );

</script>

Explanation:

[ attribute=value] in this case attribute=type, value=text.

For more information about jquery selectors visit:http://api.jquery.com/category/selectors/