CSC 230: The Week beginning Nov. 17 |
$("#imgCartoon").attr('src',JSON_Response.cartoons[myIndex].Image);
$.getJSON('CarFacts.json', function (data) { JSON_Response = data; //JSON_Response declared globally //alert(JSON_Response.cars[0].carManufacturer); }); //end getJSON
$("select").change(function () { var myIndex = $(this).val();Of all of the elements (in the above case selects) $(this) means the one the user actually interacted with.