This code is reading the first letter of the arrays name, but I want it to read the first object in that array. It's supposed to read an elements array attribute (which it does) then access the first thing in that array. This is my first time working with arrays so this may be a very silly question :)
Thanks heaps.
//array of strategies
//leads
var leads = new Array();
leads[0] = "Test 1";
leads[1] = "Test 2";
leads[2] = "Test 3";
$("button").click(function () {
//get category
var currentCat = $(this).attr("array");
$("#danWell h1").text($(this).attr('id')); //don't worry about this line
$("#danWellContent").text(currentCat[0]);
})
$(this).attr("array");??? Put a full code example directly in your question. How doesleadswork into your situation?currentCatis going to be the value of an attribute, which can only be a string. Where does the array come into it?