I've got a bit of a tricky issue. I'm trying to add a third parameter to the following function/loop and have hit a wall. Help?
$.each(studentselectValues, function(key, value) {
$('select[name="cf_Student"]')
.append($("<option></option>")
.attr("value",key)
.text(value));
});
Here's what the code looks like for the studentselectValues variable:
studentselectValues = {
'1': 'My 1st Option',
'2': 'My 2nd Option',
'3': 'My 3rd Option'
}
What I'm doing is populating a select with the options shown above. My goal is to add a third attribute to each select. Does anyone have a clue how I would accomplish this?
Thanks in advance.