Skip to content

Loading…

showAutocompleteOnFocus doesn't work #123

Closed
fantasma98 opened this Issue · 4 comments

2 participants

@fantasma98

I cant get showAutocompleteOnFocus to work with my implementation as it doesn't output the full list of categories that the user can add, when the input field is clicked

<script type="text/javascript">```

            $(document).ready(function() {                
                $('form-post').bind("keyup", function(e) {
                    var code = e.keyCode || e.which; 
                    if (code  == 13) {               
                        e.preventDefault();
                        return false;
                    }
                });
                $("#categories").tagit({


                    fieldName: "categories[]",
                    availableTags: <?php echo $categories; ?>,
                    showAutocompleteOnFocus:true,
                    allowSpaces:true,
                    afterTagAdded: function(event,ui){
                        event.preventDefault();
                        //alert(ui.tagLabel);
                        $.ajax({
                            type: "POST",
                            url: category/insertCategory',
                            data:{"cat-name":ui.tagLabel.toString()},
                            cache:false
                        });
                    }

                });
            });
    </script>

I'm using jQuery 1.8.3 with jQuery UI 1.9.1

$categories Output

["Categoria","Categoria 1","Categoria 2"]
@aehlke
Owner

Is it possible you can put a demo online that shows the unexpected behavior? That'd help debug, thanks!

@fantasma98

Here's a fiddle on the page source

http://jsfiddle.net/5HPCN/

Thank you

@aehlke
Owner

Sorry about that, fixed in 1b5378a !

@aehlke aehlke closed this
@fantasma98

Super! It's working now! Thank you for the awesome support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.