javascript - Can I put a <select> function in a table via innerHTML? -


this have been attempting do. has not worked far. don't know if possible hope can help. willing take advice going.

thanks

cell1.innerhtml = "<b>" +  (i+1) + "</b>";   cell2.innerhtml = "<b>" + array1[j] + "</b>"; cell3.innerhtml = '<select id="hgls">                       <option selected="">-</option>                       <option value="0">0</option>                       <option value="1">1</option>                       <option value="2">2</option>                       <option value="3">3</option>                       <option value="4">4</option>                       <option value="5">5</option>                   </select>'; cell4.innerhtml = <select id="agls">                       <option selected="">-</option>                       <option value="0">0</option>                       <option value="1">1</option>                       <option value="2">2</option>                       <option value="3">3</option>                       <option value="4">4</option>                       <option value="5">5</option>                       <option value="6">6</option>                       <option value="7">7</option>                       <option value="8">8</option>                       <option value="9">9</option>                       <option value="10">10</option>                       <option value="11">11</option>                       <option value="12">12</option>                       <option value="13">13</option>                       <option value="14">14</option>                       <option value="15">15</option>                       <option value="16">16</option>                       <option value="17">17</option>                       <option value="18">18</option>                       <option value="19">19</option>                       <option value="20">20</option>                   </select>; 

simple remove line-breaks (or escape them) , wrap the select cell4 quotes.

cell4.innerhtml = '<select id="agls"><option selected="">-</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option></select>'; 

demo


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -