i can't seem to make the old js scripts that i found on the magical SO.
<div class="form-actions">
<%= f.button :submit, class:"btn btn-success create-campaign" %>
</div>
this is my submit button.But there is a problem.
<div class="message-div" id="textField" contenteditable="true" maxlength="180"></div>
<%= f.input :message ,as: :text,as: :hidden ,input_html: { class: 'special', maxlength:'180' } %>
i use div to get the input for what i have done for it but my form takes its input from the hidden text area.
So i tried to do take take the content of the div and write it to the text area when submit button clicked.
but the js script that i wrote does not getting executed.
$(document).on("click",".create-campaign",function(e){
console.log('asdasd');
var a = $('.message-div').html();
document.getElementById('.special').value = a;
});
this is the code.
When i changed the listener class to another button, it works without a problem ( at least i see console log) but not when the submit button is pressed.
What should i do?
Cheers.