jquery-delegate

Newly added elements using delegate() won't bind jscolor.js

巧了我就是萌 提交于 2019-12-21 05:08:10
问题 I have a simple form, where each line consists of 3 input fields. on one of those fields, I use jscolor.js (field has a class="color" and thus binds the JS). However, when I add new lines using jQuery's delegate() , the input field doesn't bind the JS and the expected functionality is not there. http://jsfiddle.net/alexwald/qARzP/ <script> var line = '<li class="form_line" id="line"> <span> <label for="item">Item:</label> <input type="text" required="required" placeholder="what item is this?"

Is there a way to unbind a delegated event on each element instance?

天大地大妈咪最大 提交于 2019-12-10 23:42:39
问题 What I need to do is get the functionality of jQuery.one on each matched element using delegation. As you can see clicking on the link for "Baz" or "Bat" appends "(removed)" multiple times. On the other hand clicking the link for "Foo" executes the code only once, but then also disables it for "Bar" (or vice versa). Fiddle: http://jsfiddle.net/JcmpN/ What i want to happen is that clicking on any of these executes the handler for that element, but leaves the others intact until they are also

Newly added elements using delegate() won't bind jscolor.js

随声附和 提交于 2019-12-03 15:52:43
I have a simple form, where each line consists of 3 input fields. on one of those fields, I use jscolor.js (field has a class="color" and thus binds the JS). However, when I add new lines using jQuery's delegate() , the input field doesn't bind the JS and the expected functionality is not there. http://jsfiddle.net/alexwald/qARzP/ <script> var line = '<li class="form_line" id="line"> <span> <label for="item">Item:</label> <input type="text" required="required" placeholder="what item is this?" id="item" name="item[]> </span> <span> <label for="amount">Amount: </label> <input required="required"