jQuery HTML Manipulation

  • ການໄປຕໍ່ຫົນທີ່ຫນຶ່ງຫລັງ
  • ການໄປຕໍ່ຫົນທີ່ຫນຶ່ງ

jQuery contains many powerful functions for changing and manipulating HTML.

Change HTML Content

Syntax

$(selector).html(content)

html() function changes the content (innerHTML) of the matched HTML elements.

Example

$("p").html("W3School");

Try It Yourself

Add HTML Content

Syntax

$(selector).append(content)

append() function appends content inside the matched HTML elements.

Syntax

$(selector).prepend(content)

prepend() function prepends content inside the matched HTML elements.

Example

$("p").append(" CodeW3C.com");

Try It Yourself

Syntax

$(selector).after(content)

after() function inserts HTML content after all matching elements.

Syntax

$(selector).before(content)

before() function inserts HTML content before all matching elements.

Example

$("p").after(" CodeW3C.com.");

Try It Yourself

jQuery HTML Operation - From This Page

ຫົວຂໍ້ ອະທິບາຍ
$(selector).html(content) ປ່ຽນແປງ HTML “ພາຍໃນ” (Internal) ປະກອບສະຖານທີ່ທີ່ຖືກເລືອກ
$(selector).append(content) ສະເພາະ HTML “ການເພີ່ມ” (Append) ໃນປະກອບສະຖານທີ່ທີ່ຖືກເລືອກ
$(selector).prepend(content) ສະເພາະ HTML “ການປະກອງ” (Prepend) ໃນປະກອບສະຖານທີ່ທີ່ຖືກເລືອກ
$(selector).after(content) ສະເພາະ HTML ພາຍຫລັງປະກອບສະຖານທີ່ທີ່ຖືກເລືອກ
$(selector).before(content) ສະເພາະ HTML ກ່ອນປະກອບສະຖານທີ່ທີ່ຖືກເລືອກ

ສຳລັບຄູ່ມືທີ່ສົມບູນຫຼັກຂໍ້ມູນ, ກະລຸນາເຂົ້າຮອງທີ່ ຄູ່ມືການຄວບຄຸມ HTML jQuery.

  • ການໄປຕໍ່ຫົນທີ່ຫນຶ່ງຫລັງ
  • ການໄປຕໍ່ຫົນທີ່ຫນຶ່ງ