我在这里使用了解决方案 http://jsfiddle.net/KADqA/23/将图像添加到 jquery 移动复选框,它工作正常,但现在标签文本与复选框图像不对齐(太高了) 我不知道如何用 css 将其居中。
这是生成html的部分代码
<input type=checkbox id=chk" + ingindex + " class='chk chk" + ingindex + "' name=chk" + ingindex + "><label for=chk" + ingindex + ">" + item + "<a href='#' data-rel='dialog' ><img class=recimg src='http://webrecipemanager.com/images/recipe/" + image + "' alt='" + name + "'></a></label>
这是从 firebug 生成的 html
<div id="div0" class="drag inaisle ui-draggable" name="div0">draggable=Object {
element={...}, options={...}, started=
false
, more...}jQuery16405345229560181788=Object { events={...}, handle=function()}
<div class="ui-checkbox">
<input id="chk0" class="chk chk0" type="checkbox" name="chk0">checkboxradio=Object { element={...}, options={...}, label={...}, more...}jQuery16405345229560181788=Object { events={...}, handle=function()}virtualMouseBindings=Object { vmousedown=
true
, vclick=
true
}
<label class="ui-btn ui-btn-corner-all ui-btn-icon-left ui-checkbox-off ui-btn-up-i" for="chk0" data-corners="true" data-shadow="false" data-iconshadow="true" data-wrapperels="span" data-icon="checkbox-off" data-theme="i">corners=
true
shadow=
false
iconshadow=
true
wrapperEls=
"span"
icon=
"checkbox-off"
theme=
"i"
buttonElements=Object { bcls=
"ui-btn ui-btn-up-i ui-b...er-all ui-btn-icon-left"
, outer=label.ui-btn, inner=span.ui-btn-inner, more...}jQuery16405345229560181788=Object { events={...}, handle=function()}virtualMouseBindings=Object { vmouseover=
true
, vclick=
true
}
</div>
<input id="item0" type="hidden" value="1/2 c Baking Cocoa" name="item0">
<input id="ing0" type="hidden" value="Baking Cocoa" name="ing0">
</div>