ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Generate dynamic TextBoxes based on DropDownList selection using jQuery<p>Hi <a class="username" rel="himani895"> himani895</a>,</p> <p>Please refer below sample.</p> <p>Remove this line of code</p> <p><code class="js spaces"></code><code class="js plain">$(</code><code class="js string">"#divAnswers"</code><code class="js plain">).hide();</code></p> <p>and add style to disable div.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <div class="demo_block"> <pre class="brush: html">&lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { $(&#34;#ddl1&#34;).change(function () { var total = $(&#34;#ddl1&#34;).val(); var rawhtml = &#34;&#34;; for (var i = 1; i &lt;= total; i++) { rawhtml += &#34;Q. &#34; + i + &#34;&lt;textarea id=&#39;txtbox&#34; + i + &#34;&#39; class = &#39;txtoption&#39; wrap = &#39;hard&#39;/&gt;&lt;br/&gt;&#34;; $(&#39;#divAnswers&#39;).show(); $(&#34;#ddlAnswers&#34;).change(function () { var noOfAnswers = $(&#34;#ddlAnswers&#34;).val(); var rawhtml1 = &#34;&#34;; for (var j = 1; j &lt;= noOfAnswers; j++) { rawhtml1 += &#34;Ans&#34; + j + &#34;&lt;textarea id=&#39;txtAnswer&#34; + j + &#34;&#39; class = &#39;txtans&#39; wrap = &#39;hard&#39;/&gt;&lt;br/&gt;&#34;; } $(&#34;#allanswer&#34;).html(rawhtml1); }); } $(&#34;#alltext&#34;).html(rawhtml); }); }); &lt;/script&gt; &lt;div&gt; &lt;div id=&#34;ddlquestions&#34;&gt; Number of questions: &lt;select id=&#34;ddl1&#34;&gt; &lt;option value=&#34;1&#34;&gt;1&lt;/option&gt; &lt;option value=&#34;2&#34;&gt;2&lt;/option&gt; &lt;option value=&#34;3&#34;&gt;3&lt;/option&gt; &lt;option value=&#34;4&#34;&gt;4&lt;/option&gt; &lt;option value=&#34;5&#34;&gt;5&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;br /&gt; &lt;div id=&#34;divAnswers&#34; style=&#34;display: none&#34;&gt; How many answers? &lt;select id=&#34;ddlAnswers&#34;&gt; &lt;option value=&#34;1&#34;&gt;1&lt;/option&gt; &lt;option value=&#34;2&#34;&gt;2&lt;/option&gt; &lt;option value=&#34;3&#34;&gt;3&lt;/option&gt; &lt;option value=&#34;4&#34;&gt;4&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id=&#34;alltext&#34;&gt; &lt;/div&gt; &lt;div id=&#34;allanswer&#34;&gt; &lt;/div&gt; &lt;br /&gt; &lt;input type=&#34;button&#34; id=&#34;btnsave&#34; runat=&#34;server&#34; value=&#34;save&#34; /&gt; &lt;/div&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/213755/Generate-dynamic-TextBoxes-based-on-DropDownList-selection-using-jQuery/https://www.aspforums.net:443/Threads/213755/Generate-dynamic-TextBoxes-based-on-DropDownList-selection-using-jQuery/Fri, 12 Oct 2018 06:21:01 GMT