setattribute is not a function jquery

JavaScript
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);
Source

Also in JavaScript: