我在下面的代码中正确使用jquery appendTo方法吗?
我问,因为当我在jsfiddle中测试它时它似乎正确显示但是当我在我的本地服务器上使用相同的代码时(在FF,IE和Chrome中)它显示为带有细长的盒子:
我假设我做错了什么.谢谢.
HTML
<div class="ws-css-table" >
<div class="ws-css-table-tr">
<div class="ws-css-table-td"></div>
<div class="ws-css-table-td"></div>
</div>
<div class="ws-css-table-tr">
<div class="ws-css-table-td"></div>
<div class="ws-css-table-td"></div>
</div>
<div class="ws-css-table-tr">
<div class="ws-css-table-td"></div>
<div class="ws-css-table-td"></div>
</div>
</div>
<br/>
<button id="css-icol">Col +</button><br/><br/>
Run Code Online (Sandbox Code Playgroud)
jQuery的
$('#css-icol').click(function(){
$(".ws-css-table-td:last").clone().appendTo('.ws-css-table-tr');
var tblArr = $('.ws-css-table > .ws-css-table-tr').map(function ()
{
return $(this).children().map(function ()
{
return $(this);
});
});
lastCol = $('.ws-css-table-tr:first > .ws-css-table-td').length;
for (r=0; r<$('.ws-css-table-tr').length; r++)
tblArr[r][lastCol-1].text('X');
});
Run Code Online (Sandbox Code Playgroud)
CSS
.ws-css-table {
display: table;
}
.ws-css-table-tr {
display: table-row;
}
.ws-css-table-td {
display: …
Run Code Online (Sandbox Code Playgroud) 我有以下c#代码将创建一个单选按钮数组.如何在不单独按下每个按钮的情况下检查选择了哪个按钮?
谢谢.
public Form1()
{
InitializeComponent();
string[] stringArray = new string[3];
stringArray[0] = "Yes";
stringArray[1] = "No";
stringArray[2] = "Maybe";
System.Windows.Forms.RadioButton[] radioButtons = new System.Windows.Forms.RadioButton[3];
for (int i = 0; i < 3; ++i)
{
radioButtons[i] = new RadioButton();
radioButtons[i].Text = stringArray[i];
radioButtons[i].Location = new System.Drawing.Point(10, 10 + i * 20);
this.Controls.Add(radioButtons[i]);
}
}
Run Code Online (Sandbox Code Playgroud)