So. 2 입력 (x, y) 및 언론 제출 코드를 끌기 div (예 : 5x5) 때. div를 클릭하면 div 배경색을 변경하고 싶습니다.클릭하여 div 배경색 변경
<script>
$(function() {
$(".tile").click(function() {
$(this).css('background-color', '#000000');
});
});
</script>
을하지만 그 작동하지 :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Feladat10</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form method="post">
<input type="text" name="x"/>
<input type="text" name="y"/>
<input type="submit" name="submit"/>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$x = $_POST['x'];
$y = $_POST['y'];
echo "<br/>";
for($i=1; $i <= $x; $i++)
{
echo "<br/><div class='tile'>".$i."</div>";
for($j=1; $j < $y; $j++)
{
echo "<div class='tile'>".$j."</div>";
}
}
}
?>
필자는이 코드를 시도. 어떤 생각을 어떻게 해결할 수 있습니까? 나는 JQuery와 HTML 파일
콘솔에서 무엇을 보여? –
@Sanooj T Uncaught ReferenceError : $이 정의되지 않았습니다. –
은 jquery.js 파일입니다. –