无法将表行附加到表Jquery

时间:2017-12-08 19:29:35

标签: javascript jquery html html5

我试图在单击提交按钮后将表格行附加到表格中,但它不会附加。

这是HTML:

<!DOCTYPE html>
<html>
<head>
<title>Pixel Art Maker!</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Monoton">
<link rel="stylesheet" href="styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

   

<h2>Choose Grid Size</h2>
<form id="sizePicker">
    Grid Height:
    <input type="number" id="input_height" name="height" min="1" value="1">
    Grid Width:
    <input type="number" id="input_width" name="width" min="1" value="1">
    <input type="submit">
</form>

<h2>Pick A Color</h2>
<input type="color" id="colorPicker">

<h2>Design Canvas</h2>
<table>
<table>

<script src="designs.js"></script>

这是我的JS文件:

function makeGrid() {    
    $('#sizePicker').on('submit', function( evt ) {
        evt.preventDefault();
        $('table').append('<tr></tr>');
    });
}
(function () { 
  makeGrid();
 }());

0 个答案:

没有答案