Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

issue-931-search-cleared-event #963

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions dev/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,16 @@

<body style="padding: 20px;">
<div class="container" style="padding: 20px; margin-top:20px;">
<div class="checkbox" id="myCheckbox">
<label class="checkbox-custom" data-initialize="checkbox">
<input class="sr-only" type="checkbox" value="">
<span class="checkbox-label">Custom checkbox unchecked on page load</span>
</label>
</div>
<div class="checkbox" id="myCheckbox2">
<label class="checkbox-custom" data-initialize="checkbox">
<input class="sr-only" checked="checked" type="checkbox" value="">
<span class="checkbox-label">Custom checkbox checked on page load</span>
</label>
</div>
<div class="checkbox" id="myCheckbox3">
<label class="checkbox-custom" data-initialize="checkbox">
<input class="sr-only" disabled="disabled" type="checkbox" value="">
<span class="checkbox-label">Disabled custom checkbox unchecked on page load</span>
</label>
</div>
<div class="checkbox" id="myCheckbox4">
<label class="checkbox-custom" data-initialize="checkbox">
<input class="sr-only" checked="checked" disabled="disabled" type="checkbox" value="">
<span class="checkbox-label">Disabled custom checkbox checked on page load</span>
</label>
<div class="thin-box">
<div class="search input-group searched" data-initialize="search" role="search" id="mySearch">
<input type="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<span class="glyphicon glyphicon-search"></span>
<span class="sr-only">Search</span>
</button>
</span>
</div>
</div>

</div>
Expand Down
5 changes: 3 additions & 2 deletions js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,16 @@
else {
val = this.$input.val();

if(val!==this.activeSearch){
if(val!==this.activeSearch || !val){
this.$icon.removeClass(remove).addClass(search);
if(val) {
this.$element.removeClass('searched');
}
else if (this.options.clearOnEmpty){
this.clear();
}
}else{
}
else{
this.$icon.removeClass(search).addClass(remove);
}
}
Expand Down