0
jquery attr(key,func(){})
例 Jquery attr exampleattr(key,func)
を使用して境界を適用しましたが、最初のテーブルタグの境界線が適用されていません。私もjQueryライブラリのdifferrentバージョンを試してみましたが、jqueryが最初のテーブルタグをレンダリングしていません
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>An Example for testing | QcTutorials</title>
</head>
<head>
<title>The Selecter Example</title>
<script type="text/javascript" src="../../js/jquery.js">
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("table").attr("border", function(arr) {
return arr;
})
});
</script>
</head>
<body>
<table>
<tr>
<td>This is first table</td>
</tr>
</table>
<table>
<tr>
<td>This is second table</td>
</tr>
</table>
<table>
<tr>
<td>This is third table</td>
</tr>
</table>
</body>
</html>
ボーダー属性のみ1または0を取るようにしてみてください: 'のattr( '国境'、1)' – Pete
あなたが学ぶ場合、それが役立ちますいくつかの基本的なjavascriptのデバッグ手法。この場合、関数内に 'alert(または' console.log'(F11))を追加してください: '$(" table ")attr(" border "、function(arr){alert(arr);}' '$(" table ")。attr(" border "、0);'これを直接試してみてください。 –