Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   Удаление select (https://javascript.ru/forum/events/11722-udalenie-select.html)

Раман 09.09.2010 16:04

Удаление select
 
удаляю так
selec = document.getElementById('forma')
im = document.getElementById('i0')
selec.removeChild(im);
Удаляется только содержимое селекта а сам остается. Как удалить полностью?

inGray 09.09.2010 16:34

selec.parentNode.removeChild(selec)
как-то так... Удалится полностью селект... во всеми элементами

Раман 10.09.2010 10:45

Не работает все способы уже перепробовал. Вот тут посотри я видео сделал как получается

exec 10.09.2010 12:00

<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>

Раман 10.09.2010 12:19

exec Дело в том что статический селект удаляется а вот динамический который я создаю не удаляется.

exec 10.09.2010 12:55

<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.