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

Commit

Permalink
Merge pull request #963 from BenjaminNeilDavis/issue-931-search-clear…
Browse files Browse the repository at this point in the history
…ed-event

issue-931-search-cleared-event. Fixes #931.
  • Loading branch information
interactivellama committed Jan 5, 2015
2 parents 208d722 + c2489ce commit a82bf2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
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

0 comments on commit a82bf2c

Please sign in to comment.