I'm implementing Ace text editor into a form partial that I'm using for all my settings. The form id is something like "edit_setting_#{@setting.id}". I've got the text editor substituting for the field and it works perfectly when I hard-code the form id. How do I set it dynamically?
<script>
$(document).ready(function(){
var editor = ace.edit('editor');
editor.setTheme('ace/theme/twilight');
$('#setting_value').hide();
$("#edit_setting_16").submit(function(){
$('#setting_value').val(editor.getSession().getValue());
});
});
</script>
I was over-complicating it.