I'm trying to create a datePicker calendar instance based on a dynamic element ID from a jQuery cloned table row. $clTRow is the cloned row:
$clTRow.find("a").each(function(){
var orig = (this.id.match(/\d+$/) || [0])[0];
var num = +(this.id.match(/\d+$/) || [0])[0] + 1;
var inputName = "sf215Date" + orig + "" + num;
var inputTitle = "SF215 Date " + orig + "_" + num;
/when I try to create the option string dynamicly it places quotes around the string which I believe invaidates it. /
var opts = '{formElements:{'+ inputName + ': "m-sl-d-sl-Y"},calendarIconTitle :' + inputTitle + '};';
/* if I put the variable name in it takes it as a string literal */
var opts = {formElements:{inputName : "m-sl-d-sl-Y"},calendarIconTitle :inputTitle };
/* if I use eval() around the var name, it tells me that I'm missing a semi colon*/
var opts = {formElements:{eval("inputName") : "m-sl-d-sl-Y"},calendarIconTitle :eval ("inputTitle")};
datePickerController.createDatePicker(opts);
});
Is there any way to pass in a dynamicly generated ID and Title.?
I'm trying to create a datePicker calendar instance based on a dynamic element ID from a jQuery cloned table row. $clTRow is the cloned row: $clTRow.find("a").each(function(){ var orig = (this.id.match(/\d+$/) || [0])[0]; var num = +(this.id.match(/\d+$/) || [0])[0] + 1; var inputName = "sf215Date" + orig + "" + num; var inputTitle = "SF215 Date " + orig + "_" + num;
/when I try to create the option string dynamicly it places quotes around the string which I believe invaidates it. /
var opts = '{formElements:{'+ inputName + ': "m-sl-d-sl-Y"},calendarIconTitle :' + inputTitle + '};';
/* if I put the variable name in it takes it as a string literal */ var opts = {formElements:{inputName : "m-sl-d-sl-Y"},calendarIconTitle :inputTitle };
/* if I use eval() around the var name, it tells me that I'm missing a semi colon*/ var opts = {formElements:{eval("inputName") : "m-sl-d-sl-Y"},calendarIconTitle :eval ("inputTitle")};
datePickerController.createDatePicker(opts);
Is there any way to pass in a dynamicly generated ID and Title.?