I am trying to pass a string in the onClick event handler function\'s arguments of the dynamically created anchor element, see the fiddle http://jsfiddle.net/shmdhussain/bXYe4/.
var funcName = "SelectPickerBtnSelectEvent('" + str + "')"; $(".btn.dropdown-toggle.btn-light").attr("onclick", funcName);