首页 > Web开发 > 详细

表格添加一行并在每行第一列大写字母显示jquery实现方法

时间:2016-07-02 11:40:28      阅读:158      评论:0      收藏:0      [点我收藏+]

表格添加一行并在每行第一列大写字母显示jquery实现方法

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>add_tr</title>

<script src=‘jquery.js‘></script>
<script>
//create letter
var letterArr = [];
for(var i=65,j=0;i<91;i++,j++)
{
letterArr[j] = String.fromCharCode(i);
}
$(function(){
$(‘#btnok‘).on(‘click‘,function(){
alert($(‘input.add‘));
$(‘table:last‘).append(‘<tr>‘ + $(‘table tr:last‘).html() + ‘</tr>‘);
orderLine();
});
orderLine();
});
//defined add letter function
function orderLine(){
//get input where class eq add
$(‘input.add‘).each(function(i){
console.log($(this));
//$(this).children("tr:first").
$(this).val(letterArr[i]);
});
}
</script>
</head>
<body>
<input id="btnok" type=‘button‘ value="click">
<table border=‘1‘ width="400" id="tta">

<tr width="200">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>

<tr width="200">
<td><input type="text" class="add"></td>
<td><input type="text"></td>
<td><input type="text"></td>
<td><input type="text"></td>
<td><input type="text"></td>
</tr>

</table>
</body>
</html>

表格添加一行并在每行第一列大写字母显示jquery实现方法

原文:http://www.cnblogs.com/hjxcode/p/5634994.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!