-
-
Save dennismonsewicz/11c8bf6941a4515ae3d8 to your computer and use it in GitHub Desktop.
CoffeeScript for dynamic form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ready = -> | |
if $('body').hasClass 'service_requests' | |
template = $('#blank_template').html() | |
$('.add_more').on 'click', (event)-> | |
new_object_id = new Date().getTime() | |
html = template.replace /index_to_replace_with_js/g, new_object_id | |
$('#nested_items').append '<div class="new_item">' + html + '</div>' | |
$('.new_item select').selectpicker() | |
event.preventDefault() | |
$(document).ready(ready) | |
$(document).on('page:load', ready) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment