Удаление select
удаляю так
selec = document.getElementById('forma') im = document.getElementById('i0') selec.removeChild(im);Удаляется только содержимое селекта а сам остается. Как удалить полностью? |
selec.parentNode.removeChild(selec)
как-то так... Удалится полностью селект... во всеми элементами |
Не работает все способы уже перепробовал. Вот тут посотри я видео сделал как получается
|
<html> <head> <title> Удаление SELECT'-ов </title> </head> <body> <select id="foo"> <option> 1 </option> <option> 2 </option> <option> 3 </option> </select> <a href="javascript://" onclick="var t = document.getElementById( 'foo' ); t.parentNode.removeChild( t );"> Удалить </a> </body> </html> |
exec Дело в том что статический селект удаляется а вот динамический который я создаю не удаляется.
|
<html> <head> <title> Удаление SELECT'-ов </title> </head> <body> <script type="text/javascript"> var x = document.createElement( 'SELECT' ); x.id = 'foo'; document.body.appendChild( x ); </script> <a href="javascript://" onclick="var t = document.getElementById( 'foo' ); t.parentNode.removeChild( t );"> Удалить </a> </body> </html> |
Часовой пояс GMT +3, время: 12:37. |