[英]How to enhance a dynamically created Jquery Mobile checkbox?
I'm struggling to get this to work: 我正在努力使这个工作:
var selectorBox = $('<label for="'+selectorID+'"><input type="checkbox" id="'+selectorID+'" name="'+selectorID+'" class="selector" data-inline="true" data-iconpos="notext"></label>').trigger('create'),
cell = $( "<th class='persist essential notxtchkbx rowHigh' "+rowSpanner+"></th>" ).append( selectorBox );
currentRow.prepend( cell );
selectorBox
is the checkbox HTML, which I'm trying to enhance by trigger("create")
before creating a cell and inserting this cell in a table row. selectorBox
是复选框HTML,在创建单元格并将此单元格插入表格行之前,我试图通过trigger("create")
进行增强。
Question : 问题 :
How do I get this checkbox to render properly? 如何获得此复选框以正确呈现?
Thanks for help! 感谢帮助!
To enhance a checkbox you will need to call trigger("create")
on its parent element . 要增强复选框,您需要在其父元素上调用trigger("create")
。 Calling it directly on the checkbox does not work. 直接在复选框上调用不起作用。 Just use something like: 只需使用类似:
$("input.myCheckbox").closest("div").trigger("create");
And it should work. 它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.