jquery - How can I use autocomplete with event binding? -


This is my first post here, I have a form before I have answered here where I have the fields which automatically Is complete .
Is it possible to use event binding to complete myself instead of adding autocomplete for each field?
I'm a newbie about the events of JavaScript.
This is what I did to add a new line using event binding (works perfectly)

  $ (function () {$ ('input [name = addItem]') .bind ('click', function () {var line = $ ('# list> div ''. (); $ ('' Id ',' id ', divId); $ (' # List ') .and (divCloned); var input = $ (divCloned) child (' input '). (In input for var i) {inputs [i] .value =' '; input [i] id = inputs [I] .id.replace (/ \ d + /, line); input [i] .name = inputs [i] .name.replace (/ \ d + /, line);} this.blur ();} );});  

I am also not sure that I have presented my question in a proper way. Thank you

If I correctly understand your question, then you want to have your input Apply to input field? You can do this by normalizing your selector, so rather than adding this event to $ ('input [name = addItem]') (mean: all tags of "input" with one attribute For example, set the name to "Additem") For example you can use $ ('input [type = text]') , which will " Input ".

Depending on your application, do you want to change the suggested auto-breakable based on the click on that input field? Will require more logic in your event handler.


Comments