I have a bunch of select elements in a form that I am using the jQuery Chosen plugin. I am not able to reset the form:
I have referred this link but nothing worked for me:
My code is:
$scope.share = function (share_data,type, doc_type) {
// $('.userlist').chosen().destroy()
$scope.sharedgroup = [];
$scope.users_select = "";
// $scope.sharetype = type;
$scope.doc_type = doc_type;
$scope.shareid = share_data._id;
console.log(share_data)
$('#shareModal').modal('toggle');
$scope.getclientshare(share_data);
// $(".userlist").val([]).trigger('chosen:updated')
$scope.getfilterlist=function(){
$http.post("/getuserslist", { 'users': 'list'}).then(function (response) {
$scope.userlist = response.data
$(".userlist").val('').trigger("chosen:updated");
$timeout(function () {
$(".userlist").chosen({ disable_search_threshold: 3 });
$scope.page_loader = false;
});
});
}
$scope.getfilterlist();
};
Is there any mistake I have done?