Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. jQuery(document).ready(function($){
  2.  
  3. $(':input[name="createQuestions"]').click(createQuestions);
  4. $(':input[name="createAnswer"]').click(function(){
  5. console.log("sd")
  6. });
  7. });
  8.  
  9.  
  10. function createAnswer(){
  11.  
  12. alert(1);
  13. }
  14.  
  15. function createQuestions(){
  16. var numbQuest = $(':input[name="numbQuest"]').val(),
  17. i;
  18.  
  19. $('#step2').html('<p> Шаг 2</p>')
  20.  
  21. for (i = 1;i <= numbQuest; i++){
  22.  
  23. $('#step2').append('<div class="question"></div>')
  24. $('#step2 > div.question:last').append('<p>Вопрос №' + i +'</p>');
  25. $('#step2 > div.question:last').append('<div> <textarea name="question" id="q' + i + '" cols="60" rows="5"></textarea> </div>');
  26. $('#step2 > div.question:last').append('<p>Ответы</p>');
  27. $('#step2 > div.question:last').append('<div class="answer"> </div>');
  28. $('#step2 > div.question:last').append('<div class="add_answer"> <input type="button" name="createAnswer" value="Добавить ответ..." class="btn"> </div>');
  29.  
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement