// An highlighted block
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap 实例 - 基本的表格</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<table class="table">
<caption>基本的表格布局</caption>
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>城市</th>
</tr>
</thead>
<tbody>
{foreach $data as $v}
<tr>
<td>{$v.id}</td>
<td><span class="ids" tot="{$v.id}">{$v.title}</span>
<input type="text" name="title" hidden class="aaa" tot="{$v.id}"></td>
<td>{$v.sev}</td>
</tr>
{/foreach}
</tbody>
</table>
</body>
</html>
<script>
$('.ids').click(function () {
var title=$(this).html();
$(this).hide();
$(this).next().show().val(title);
$('.aaa').change(function () {
var id=$(this).attr('tot');
var title=$(this).val();
var _this=this;
$.ajax({
type: "POST",
url: "{:url('save')}",
data: {title,id},
success: function(msg){
if (msg.code==200){
$(_this).hide();
$(_this).prev().show().html(title);
}
}
});
})
})
</script>
08-05
848
08-09
08-09
08-09