본문 바로가기
카테고리 없음

.html() tr td 생략됨

by 향유 2021. 4. 2.

before source

<div id="list_file_tag" class="sr-only">
    <tr>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input id="Warranty01_01" type="radio" name="Warranty01">
        <label for="Warranty01_01" value="yes">Yes</label>
        <input id="Warranty01_02" type="radio" name="Warranty01">
        <label for="Warranty01_02" value="no">No</label>
      </td>
      <td>
        <input id="Doa01_01" type="radio" name="Doa01">
        <label for="Doa01_01" value="yes">Yes</label>
        <input id="Doa01_02" type="radio" name="Doa01">
        <label for="Doa01_02" value="no">No</label>
      </td>
    </tr>
</div>
function addForm() {
console.log($('#list_file_tag').html());
}

콘솔창에 <tr> <td> 가 생략됨

after source

 

<table>
 <tbody id="list_file_tag" class="sr-only">
    <tr>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input class="flexible_table__input" type="text">
      </td>
      <td>
        <input id="Warranty01_01" type="radio" name="Warranty01">
        <label for="Warranty01_01" value="yes">Yes</label>
        <input id="Warranty01_02" type="radio" name="Warranty01">
        <label for="Warranty01_02" value="no">No</label>
      </td>
      <td>
        <input id="Doa01_01" type="radio" name="Doa01">
        <label for="Doa01_01" value="yes">Yes</label>
        <input id="Doa01_02" type="radio" name="Doa01">
        <label for="Doa01_02" value="no">No</label>
      </td>
    </tr>
    </tbody>
</table>

<table><tbody> 없이 <tr>만 작성할 경우 생기는 문제로 추정 소스에 <table><tbody> 삽입해줬더니 해결

댓글