javascript - Jquery Fancyform and IE10: Checkbox does not get checked when clicking on label -
so, have weird ie10-bug (ie11 works correctly):
i've got checkbox this:
<div class="select-row row-b"> <p>some text</p> <label><input type="checkbox" name="checkboxgroupa" data-index="1" value="a1"/>a1</label> </div>
using fancyform-jquery-plugin v 1.4.2, seems there's bug in fancyform ie10:
so pretend checkbox (somewhat styled): [ a1 ] clicking somewhere within borders ( within [ ] ) works. checkbox checked. clicking straight on text (the label, "a1") not work, checkbox state not alter unchecked checked.
i added console.log("..."); fancyforms transformcheckbox-method right here:
check: function () { console.log("setting check"); method.setprop(this, "checked", 1); },
just showing me same. "check" not triggered, when click @ label.
it great hints here, out of ideas now.
best regards, dom
i had same problem, in case need bind event because ie version.
$(".select-row row-b label").bind('click',function(){ $('input',this).attr("checked",true); })
edit: here's working code, based on answer. edit code within here because there several side effects have take care of:
this.$rowlbls = $(this.$el.find('.row-alter label')); //might $('yourdomelement', 'yoursecond...'') this.$rowlbls.click(function(event) { var ele = $(this).find('input'); if( $(event.target).is("label") ) { //check label, because fired twice if not => work 1 time if(ele.is(':checked')){ ele.prop('checked', false); //prop instead of attr true/false } else{ ele.prop('checked', true); } } });
javascript jquery forms checkbox
No comments:
Post a Comment