Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to hide a text field in js?
    primarykey
    data
    text
    <p>I want to hide the text field when I select from <em>item2</em> from the list. Here is the relevant part of my code:</p> <pre><code>&lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Select Parent&lt;/label&gt; &lt;div class="controls"&gt; &lt;select name="parent_id" class="span6 m-wrap" data-placeholder="Choose a Parent" tabindex="1"&gt; &lt;option value="0" &gt;Select Parent&lt;/option&gt; &lt;?php $admin_sql=mysql_query("select * from admin_detail where parent_id='0' and role='2'"); while($Fetch_Admin=mysql_fetch_array($admin_sql)) { ?&gt; &lt;option value="&lt;?php echo $Fetch_Admin['id']; ?&gt;" onClick = "myFunction()" &gt; &lt;?php echo $Fetch_Admin['name'] ;?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Name&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="text" name="name" class="span6 m-wrap" placeholder="Name" required/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Login ID&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="text" name="login" class="span6 m-wrap" placeholder="Login ID" required/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Password&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="password" name="password" class="span6 m-wrap" placeholder="Password" required/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group" id="op1"&gt; &lt;label class="control-label" &gt;Add Options&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="text" name="option1" class="span6 m-wrap" placeholder="Option1" required/&gt; &lt;input type="text" name="option2" class="span6 m-wrap" placeholder="Option2" required/&gt; &lt;input type="text" name="option3" class="span6 m-wrap" placeholder="Option3" required/&gt; &lt;input type="text" name="option4" class="span6 m-wrap" placeholder="Option4" required/&gt; &lt;input type="text" name="option5" class="span6 m-wrap" placeholder="Option5" required/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The associated javascript function is:</p> <pre><code>&lt;script&gt; function myFunction() { document.getElementById("op1").style.visibility="hidden"; } &lt;/script&gt; </code></pre> <p>I have also tried the same thing by using a button. When I apply the <code>onClick</code> function to the button it work properly. Can some one show me where I am going wrong or which function should I use for the list.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload