I need to dynamically alter a variable with the "name" attribute from a link - code below...
<input type="text" class="datepicker" id="dp1">
<a href="javascript:;" class="tab" name="1,2">test button</a>
and
$(document).ready(function(){
var pickable = { dp1: [4,5,6] };
$(".tab").click(function () {
var test = $(this).attr("name").split(",");
pickable = { dp1: test };
});
$(".datepicker").each(function() {
$(this).datepicker({
beforeShowDay: function(date){
var day = date.getDay(), days = pickable[this.id];
return [$.inArray(day, days) > -1, ""];
},
});
});
});
Any ideas why this doesn't work??
testis an array containing the single string"1, 2"