var inputForm; $(function() { var InputForm = { $area: null, init: function(selector) { this.$area = $(selector); this.bindEvents(); return this; }, bindEvents: function() { $(document).on('click', '.glyphicon-chevron-down', function(e) { this.showInputArea(e); }.bind(this)); $(document).on('click', '.glyphicon-chevron-up', function(e) { this.hideInputArea(e); }.bind(this)); }, showInputArea: function(e) { this.getInputArea(e).slideDown(); $(e.target).addClass('glyphicon-chevron-up').removeClass('glyphicon-chevron-down'); }, hideInputArea: function(e) { this.getInputArea(e).slideUp(); $(e.target).addClass('glyphicon-chevron-down').removeClass('glyphicon-chevron-up'); }, getInputArea: function(e) { return $(e.target).parent().parent().next(); } }; inputForm = InputForm.init("form"); });
<br> <form> <div class="col-xs-9"> <p class="e_form_title"> <label>説明文 <span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span> </label> </p> <p style="display: none;"> <textarea rows="10" cols="50" name="registration_information"></textarea> </p> <input type="submit" value="登録"> </div> </form>