function run_each(){var $results = $(".results");
$results.empty();
$results.append("==================== START 1st each ====================");
console.log("==================== START 1st each ====================");
$('#my_select option').each(function(index, value){
$results.append("<br>");// log the index
$results.append("index: "+ index);
$results.append("<br>");
console.log("index: "+ index);// logs the element// $results.append(value); this would actually remove the element
$results.append("<br>");
console.log(value);// logs element property
$results.append(value.innerHTML);
$results.append("<br>");
console.log(value.innerHTML);// logs element property
$results.append(this.text);
$results.append("<br>");
console.log(this.text);// jquery
$results.append($(this).text());
$results.append("<br>");
console.log($(this).text());// BEGIN just to see what would happen if nesting an .each within an .each
$('p').each(function(index){
$results.append("==================== nested each");
$results.append("<br>");
$results.append("nested each index: "+ index);
$results.append("<br>");
console.log(index);});// END just to see what would happen if nesting an .each within an .each});
$results.append("<br>");
$results.append("==================== START 2nd each ====================");
console.log("");
console.log("==================== START 2nd each ====================");
$('ul li').each(function(index, value){
$results.append("<br>");// log the index
$results.append("index: "+ index);
$results.append("<br>");
console.log(index);// logs the element// $results.append(value); this would actually remove the element
$results.append("<br>");
console.log(value);// logs element property
$results.append(value.innerHTML);
$results.append("<br>");
console.log(value.innerHTML);// logs element property
$results.append(this.innerHTML);
$results.append("<br>");
console.log(this.innerHTML);// jquery
$results.append($(this).text());
$results.append("<br>");
console.log($(this).text());});}
$(document).on("click",".clicker",function(){
run_each();});