使用 HTML 和 jQuery 來建立表單


要使用 HTML 來建立表單,我們需要使用以下內容 -

<form action = "" method = "get">
   Details:<br><br>
   Student Name<br><input type="name" name="sname"><br>
   Exam Date and Time<br><input type="datetime-local" name="datetime"><br>
   <input type="submit" value="Submit">

要使用 jQuery 和 HTML 來建立表單,新增 input 型別 文字,如下所示 -

$form.append('<input type="button" value="button">');

一個更好的示例是 -

$myform = $("<form></form>");
$myform.append('<input type="button" value="button">');
$('body').append($myform);

更新於: 2023-11-12

1K+ 瀏覽

開啟你的 職業

完成課程後獲得認證

開始吧
廣告
© . All rights reserved.