html - How to use JavaScript to hide a text area -


when click on button textarea appear allowing user type message .after type message want textarea hide.

can 1 me how hide textarea after entering message.

this javascipt code:

        <script>         function showdiv1() {         document.getelementbyid('welcomediv1').style.display = "block";                             }         </script> 

this html code:

       <div> <span style="display: inline-block;text-align: center; margin:-73px 0px -10px 61px; "><a href ="#"><img src="/wp-content/uploads/2013/03/reject_5.jpg" width="60" height="60" style="margin:0px 0px 0px 0px"  value="show div" onclick="showdiv()"/></a><br />decline</span></div>        <textarea id="welcomediv"  style=" display:none; border:1px solid #666666; height:70px; margin:16px 0 0 8px " class="answer_list" title="message employer" onfocus="this.value=''" > message employer </textarea> 

try this

<script>     function showdiv1() {         var my_disply = document.getelementbyid('welcomediv1').style.display;         if(my_disply == "block")               document.getelementbyid('welcomediv1').style.display = "none";         else               document.getelementbyid('welcomediv1').style.display = "block";      } </script> 

it simple way of toggling div using 1 function,ofcourse in jquery there 1 thing can 'toggle' div


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -