<button> ใช้ได้ทุกที่ใน <body>
<button> เป็น Valid HTML ทุกที่ที่ Text-level markup อนุญาต (ไม่จำเป็นต้องอยู่ใน <form>)
ความแตกต่างกับ <input type="button">
<button>- ใส่เนื้อหาได้ (Text, Images, HTML elements)<input type="button">- ใส่เนื้อหาไม่ได้ ใช้แค่valueattribute
Default Type
นอก Form: type="button" (ไม่ Submit)
ใน Form: type="submit" (Submit Form) - ควรระบุ type="button" ชัดเจน
แนะนำ: สร้าง Button ด้วย JavaScript
หาก Button ต้องการ JS เท่านั้น ให้สร้างด้วย JS ป้องกันปุ่มทำงานไม่ได้เมื่อปิด JS