如何使用jQuery修改指定元素的属性值?

2026-06-11 13:559阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计245个文字,预计阅读时间需要1分钟。

如何使用jQuery修改指定元素的属性值?

如何使用jQuery修改指定元素的属性值?


<meta charset='utf-8'>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<script src='cdn.bootcss.com/jquery/1.10.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$(function(){
$('.ftype_input tbody tr').attr('class','even newlist');
});
});
</script>

</head>

<body>
<div class='ftype_input'>
<body>
<table class='display dataTable' id='tab' cellpadding='0' cellspacing='0' >
<thead>
<tr>
<th width='10'></th>

</tr>
</thead>
<tbody>
<tr role='row' class='odd'><td>0000</td></tr>
<tr role='row' class='odd'><td>11111111</td></tr>
</tbody>
<tfoot>
<tr>
<th class='formsubmit'>
</th>
</tr>


</tfoot>
</table>
<br />
<button>设置图像的 width 属性</button>
</div>
</body>
</html>


本文共计245个文字,预计阅读时间需要1分钟。

如何使用jQuery修改指定元素的属性值?

如何使用jQuery修改指定元素的属性值?


<meta charset='utf-8'>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<script src='cdn.bootcss.com/jquery/1.10.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$(function(){
$('.ftype_input tbody tr').attr('class','even newlist');
});
});
</script>

</head>

<body>
<div class='ftype_input'>
<body>
<table class='display dataTable' id='tab' cellpadding='0' cellspacing='0' >
<thead>
<tr>
<th width='10'></th>

</tr>
</thead>
<tbody>
<tr role='row' class='odd'><td>0000</td></tr>
<tr role='row' class='odd'><td>11111111</td></tr>
</tbody>
<tfoot>
<tr>
<th class='formsubmit'>
</th>
</tr>


</tfoot>
</table>
<br />
<button>设置图像的 width 属性</button>
</div>
</body>
</html>