web/assets/questions/questions-answers.js
/*
 * creates a new form and appends it to the collectionHolder
 */
creates a new form and appends it to the collectionHolder
creates a new form and appends it to the collectionHolder
function addNewForm() {
    var prototype = $collectionHolder.data('prototype');
    var index = $collectionHolder.data('index');
    var newForm = prototype;
    newForm = newForm.replace(/__name__/g, index);
    $collectionHolder.data('index', index+1);
    var $panel = $('<div class="panel"></div>');
    -body and append the form to it
    var $panelBody = $('<div class="panel-body"></div>').append(newForm);
    $panel.append($panelBody);
    addRemoveButton($panel);
    $addNewItem.before($panel);
    formStyle(index);
}
function addNewForm ( ) { var prototype = $collectionHolder . data ( 'prototype' ) ; var index = $collectionHolder . data ( 'index' ) ; var newForm = prototype ; newForm = newForm . replace ( / __name__ / g , index ) ; $collectionHolder . data ( 'index' , index + 1 ) ; var $panel = $ ( '<div class="panel"></div>' ) ; var $panelBody = $ ( '<div class="panel-body"></div>' ) . append ( newForm ) ; $panel . append ( $panelBody ) ; addRemoveButton ( $panel ) ; $addNewItem . before ( $panel ) ; formStyle ( index ) ; }
creates a new form and appends it to the collectionHolder
creates a new form and appends it to the collectionHolder
// getting the prototype // the prototype is the form itself, plain html // get the index // this is the index we set when the document was ready, look above for more info // create the form // replace the __name__ string in the html using a regular expression with the index value // incrementing the index data and setting it again to the collectionHolder // create the panel // this is the panel that will be appending to the collectionHolder // create the panel-body and append the form to it