2013-02-04 40 views

回答

0

只需添加的HTML標記,複選框內<span> 試試這個

.html("<span> <input type='checkbox' value='value' />test<input type='checkbox' value='value1' />test1</span >") ;   
1

.html()有幾個問題與串聯:

.html("<span>" "</span >" + " <span>""</span> ")  
    //------^^^^--------------------^^--------useless quotes are here. 

這樣:

.html("<span></span ><input type='checkbox' value='' />" + " <span>""</span> ") 

這樣:

.html("<span></span >" + " <span></span><input type='checkbox' value='' />") 

或後兩個:

.html("<span></span> <input type='checkbox' value='' />" + " <span></span><input type='checkbox' value='' />") 
0

您也可以使用html選項。

var $a = $("<a/>", { 
    "data-transition": "slide", 
    "html": $("<input>", { 
    "type": "checkbox" 
    }) 
}) 
.appendTo(li); 

,它將使這個HTML:

<a data-transition="slide"><input type="checkbox"></a>