Advertisement
Guest User

Untitled

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