JS setattribute is not a function- Firefox, chrome

You can do it by this way:

txtEndDate['dateInRegionalFormat'] = txtEndDate.value;

instead of old code:

txtEndDate.setAttribute('dateInRegionalFormat', txtEndDate.value);

Use jquery.attr() like,

$(txtEndDate).attr('dateInRegionalFormat', txtEndDate.value);

Updated there may be multiple elements so use [0] for the first element like,

txtEndDate[0].setAttribute('dateInRegionalFormat', txtEndDate.value);

You should first check whether the elements exists or not before setting attribute in it like,

if(txtEndDate.length)
{
   txtEndDate.setAttribute('dateInRegionalFormat', txtEndDate.value);
}