Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make select all and delete work in forms #29

Open
kshepherd2005 opened this issue May 4, 2016 · 2 comments
Open

How to make select all and delete work in forms #29

kshepherd2005 opened this issue May 4, 2016 · 2 comments
Labels

Comments

@kshepherd2005
Copy link

Was not showing the entire list when select all and delete was used within a form so I added this to keyup function...

if (e.keyCode == 46 && this.value == ""){

          $list.children($this.opts.ignore.trim() ? ":not(" + $this.opts.ignore + ")" : '').removeClass('selected').each(function() {

            var data = (
                        $this.opts.attribute != 'text'
                          ? ($(this).attr($this.opts.attribute) || '')
                          : $(this).text()
                        ).toLowerCase();

            var treaty = data.removeAccents($this.opts.ignore_accents).indexOf(q) == -1 || q === ($this.opts.hidden_mode ? '' : false)

              $this.opts.highlight ? $(this).removeHighlight().highlight(q).show() : $(this).show();

              $this.trigger('_after_each');

          });

}
@vdw vdw added the question label Jul 3, 2016
@mastef
Copy link

mastef commented Nov 14, 2018

@vdw This doesn't seem like a question, but more of a shortcoming/bug. The search is not cleared/recalculated if I select the text and press "delete" on the keyboard.

@mastef
Copy link

mastef commented Nov 14, 2018

Making delete worked for me with this change instead:

-if ( [38, 40, 13].indexOf(e.keyCode) == -1 && ( e.keyCode != 8 ? $this.val().length >= $this.opts.min_chars : true ) ) {
+if ( [38, 40, 13].indexOf(e.keyCode) == -1 && ( ( e.keyCode != 46 && e.keyCode != 8 ) ? $this.val().length >= $this.opts.min_chars : true ) ) {

It removes the length check if either delete or backspace have been pressed. Before it was only triggering on backspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants