การอ่านค่าจาก id ของ tag html ด้วย jquery

รวมโค้ด AJAX Javascript Library jQuery Framework ต่างๆ ที่ใช้ คู่กับ php Script Ajax โค้ด Ajax Prototype UI แนะนำได้ที่นี่

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41410
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

การอ่านค่าจาก id ของ tag html ด้วย jquery

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

การอ่านค่าจาก id ของ tag html ด้วย jquery
เช่นมี tag p มี id= example_placeholder

โค้ด: เลือกทั้งหมด

<p id="example_placeholder">Existing content that will be replaced.</p>
อ่านค่าโดยใช้

โค้ด: เลือกทั้งหมด

$('#example_placeholder').html();
และถ้าจะกำหนดค่าให้ กับ id ของ tag ใช้

โค้ด: เลือกทั้งหมด

$('#example_placeholder').html('This existing content has been replaced with this content.');
เพิ่มค่าลงใน id

โค้ด: เลือกทั้งหมด

$('#example_placeholder').append(' This text has been appended to the end.');
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 83