skip to Main Content

Javascript – Why does rowcount = x why ${rowcount + 1} alway show 1?

I want to pass value by name c_lastname31_2 c_lastname31_3 c_lastname31_4 but it always c_lastname31_1 function addRow() { const tableBody = document.querySelector("table tbody"); // จำกัดจำนวนแถวไม่เกิน 20 if (rowcount >= 20) { alert("คุณไม่สามารถเพิ่มแถวได้เกิน 20 แถว"); return; } // เพิ่มแถวใหม่ const newRow =…

VIEW QUESTION

How to dynamically retrieve the content text of a HTML tag and its child tags?

I would like to know how to dynamically retrieve the content text of a HTML tag and its child tags? Here is my HTML code, for example: <p><code>C:<select> <option value="test1">test1</option> <option value="test2">test2</option> </select>test3<select> <option value="test4">test4</option> <option value="test5">test5</option> </select>test6<select> <option value="test7">test7</option>…

VIEW QUESTION

Animation with InnerHTML

document.getElementById("first-img").addEventListener("click", function(){ document.getElementById("detail-img").innerHTML = `Detail of first img` }) document.getElementById("second-img").addEventListener("click", function(){ document.getElementById("detail-img").innerHTML = `Detail of second img` }) .container{ display: flex; height: 30px; gap: 1rem; } .img{ background-color: red; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,…

VIEW QUESTION
Back To Top
Search