Skip to content

Commit

Permalink
v2.0.4
Browse files Browse the repository at this point in the history
enable form reset
  • Loading branch information
aurovrata committed Aug 31, 2021
1 parent 785f3f4 commit dd95010
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions hybrid-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ class HybridDDError extends Error {
_.event(_.hdd, 'add',{
click: _.open
});
//listen for fomr reset.
let f = _.el.closest('form');
_.event(f,'add',{
reset:_.reset.bind(_)
})
//create a close function.
_.close = _.closeSelect.bind(_, true);
//blur function
Expand Down Expand Up @@ -472,12 +477,16 @@ class HybridDDError extends Error {
hsProtype.reset = function(){
let _ = this;
_.sindex = [];
_.value = {};
// _.clearClass('hover');
_.clearClass('active');
if(_.hdd.options['']){
_.hdd.options[''].classList.add('active');
_.value['']=_.hdd.options[''].querySelector('.hybridddl').innerHTML;
_.hdd.options[''].querySelector('input').checked=true;
_.sindex.push('');
}else _.value[''] = _.opt.defaultText;
_.hdd.selected.innerHTML = _.opt.selectedLabel(_.value);
}
//method to add event listeners.
hsProtype.event = function (ele, type, args) {
Expand Down
Loading

0 comments on commit dd95010

Please sign in to comment.