<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>JavaScript для начинающих - Форум программистов и сисадминов Киберфорум</title>
		<link>https://www.cyberforum.ru/</link>
		<description>Форум программистов JavaScript. Обсуждение вопросов от начинающих разработчиков JavaScript, помощь в решении задач.</description>
		<language>ru</language>
		<lastBuildDate>Thu, 07 May 2026 10:26:24 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>https://www.cyberforum.ru//cyberstatic.net/images/misc/rss.jpg</url>
			<title>JavaScript для начинающих - Форум программистов и сисадминов Киберфорум</title>
			<link>https://www.cyberforum.ru/</link>
		</image>
		<item>
			<title>Правый клик на картинке - JavaScript для начинающих</title>
			<link>https://www.cyberforum.ru/javascript-beginners/thread3222905.html</link>
			<pubDate>Thu, 07 May 2026 07:31:27 GMT</pubDate>
			<description>Здравствуйте ! На странице картинка. При правом клике на этой картинке появляется контекстное меню....</description>
			<content:encoded><![CDATA[<div>Здравствуйте ! На странице картинка. При правом клике на этой картинке появляется контекстное меню. Как создается это меню ?</div>

]]></content:encoded>
			<category domain="https://www.cyberforum.ru/javascript-beginners/">JavaScript для начинающих</category>
			<dc:creator>natter1</dc:creator>
			<guid isPermaLink="true">https://www.cyberforum.ru/javascript-beginners/thread3222905.html</guid>
		</item>
		<item>
			<title>Почему ничего не происходит - элементы p не добавляются на страницу? - JavaScript для начинающих</title>
			<link>https://www.cyberforum.ru/javascript-beginners/thread3222725.html</link>
			<pubDate>Fri, 01 May 2026 14:35:40 GMT</pubDate>
			<description><![CDATA[<div class="codeblock"><table class="html5"><thead><tr><td colspan="2" id="803675530" ...]]></description>
			<content:encoded><![CDATA[<div><div class="printablecode">
	<div class="smallfont">:</div>
	<hr /><code dir="ltr">&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
&nbsp; &nbsp; &lt;meta charset=&quot;UTF-8&quot;&gt;<br />
&nbsp; &nbsp; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br />
&nbsp; &nbsp; &lt;title&gt;Document&lt;/title&gt;<br />
&nbsp; &nbsp; &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&nbsp; &nbsp; &lt;div class=&quot;forms&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;h1&gt;Форма опроса&lt;/h1&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;form&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class=&quot;Name&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;label class=&quot;lname&quot;&gt;Имя пользователя:&lt;/label&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class=&quot;input&quot; type=&quot;text&quot; required/&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class=&quot;Email&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;label class=&quot;lemail&quot;&gt;Email:&lt;/label&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class=&quot;email&quot; type=&quot;text&quot; required/&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class=&quot;Button&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class=&quot;button&quot;&gt;Отправить&lt;/button&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/form&gt;<br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code><hr />
</div><br />
<div class="printablecode">
	<div class="smallfont">:</div>
	<hr /><code dir="ltr">let Name = document.querySelector('.Name');<br />
let Email = document.querySelector('.Email');<br />
let button = document.querySelector('.button');<br />
let forms = document.querySelector('.forms');<br />
<br />
let labels = document.querySelectorAll('label');<br />
let inputs = document.querySelectorAll('input');<br />
let newDiv = document.createElement('div');<br />
forms.append(newDiv);<br />
<br />
button.onclick = function(e) {<br />
&nbsp; &nbsp; e.preventDefault();<br />
&nbsp; &nbsp; let P = document.querySelectorAll('p');<br />
&nbsp; &nbsp; inputs.forEach(input =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(P) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; P.forEach(p =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.remove();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; let p = document.createElement('p');<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.textContent = input.value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newDiv.append(p); <br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; <br />
&nbsp; &nbsp; })<br />
}<br />
<br />
Name.style.marginBottom = &quot;20px&quot;;<br />
<br />
Email.style.marginBottom = &quot;20px&quot;;</code><hr />
</div>Код должен добавлять на страницу 2 элемента p с информацией из input.value, но при нажатии button - ничего не происходит и на странице не появляются элементы p.<br />
Что я сделал не так? Подскажите.<br />
<br />
Благодарю!</div>

]]></content:encoded>
			<category domain="https://www.cyberforum.ru/javascript-beginners/">JavaScript для начинающих</category>
			<dc:creator>Константин345</dc:creator>
			<guid isPermaLink="true">https://www.cyberforum.ru/javascript-beginners/thread3222725.html</guid>
		</item>
	</channel>
</rss>
