skill-assessment-app/app/assets/javascripts/admin.js

19 lines
680 B
JavaScript
Raw Normal View History

2016-08-19 16:02:18 -05:00
$(function(){
$("form").on('click', "[data-id=input_option_adder]", function(){
2017-03-06 11:46:28 -06:00
var $newLi = $(this).siblings('li').clone();
$newLi.attr('style', '');
$("[data-id=input_option_list]").append($newLi);
$newLi.find('input').focus();
2016-08-19 16:02:18 -05:00
});
$("#question_input_type").on('change', function(){
var qid = $(this).attr('data-qid') === undefined ? '' : "/" + $(this).attr('data-qid');
// /admin/question(/:question_id)/options/:input_type
2016-08-23 21:54:53 -05:00
$("[data-id=input-options-wrapper]").load("/admin/question" + qid + "/options/" + $(this).val(), function(){
$(".code-input textarea").linedtextarea();
});
});
2016-08-19 16:02:18 -05:00
});