Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.25 KB | None | 0 0
  1.           <div class="form-group">
  2.             <label>Наименование задачи:</label>
  3.             <select name="value" class="form-control" id="sel1" onclick="showOptions();">
  4.               <option value="0">---Выберите задачу---</option>
  5.               {% if tasks %}
  6.                 {% for task in tasks %}
  7.                   <option value="{{ task.id }}">{{ forloop.counter }}. {{ task.Title }}</option>
  8.                 {% endfor %}
  9.               {% endif %}
  10.             </select>
  11.           </div>
  12.  
  13.           <div class="form-group">
  14.             {% for opt in options %}
  15.               <div class="option hidden" id="{{ opt.id }}">
  16.                 <label>Значение параметра "{{ opt.Title }}":</label>
  17.                 <textarea name="opt{{ opt.id }}" id="opt{{ opt.id }}" class="textarea"></textarea>
  18.               </div>
  19.             {% endfor %}
  20.           </div>
  21.         </div>
  22.  
  23. <script type="text/javascript">
  24.     function showOptions(){
  25.         $('.option').each(function(){
  26.           $(this).addClass("hidden");
  27.         });
  28.         $('.option').each(function(){
  29.           if $("#sel1").val() == {{ {{ options.$(this).id }}.Task }}
  30.             $(this).removeClass("hidden");
  31.         });
  32.     }
  33.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement