JQUERY || 相關語法 - SeanWu1977/Machine-Learning GitHub Wiki

JQUERY Notes

$.each()

var arr = [ "one", "two", "three", "four", "five" ];
var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };

jQuery.each( arr, function( i, val ) {
  $( "#" + val ).text( "Mine is " + val + "." );
  // Will stop running after "three"
  return ( val !== "three" );
});

jQuery.each( obj, function( i, val ) {
  $( "#" + i ).append( document.createTextNode( " - " + val ) );
});