I want pass the javascript variable into rails tag. Here my code
function add_questionfield(obj)
{
var last_id = $('input[type="text"]:last').size();
last_id++;
alert(last_id);
$(".question_div_<%= @subjectModuleId %>").show();
$(".question_div_<%= @subjectModuleId %>").append('<%=text_field_tag "question_'+ last_id +'",@question.question, name: 'questions[]',class:'form-control', placeholder:'Type Question Here',
:maxlength => 200,:autocomplete => :off %>');
}
Here I pass last_id into rails tag.
Expected id was question_2
How to solve this. Thank you But its generate question_last_id
Aucun commentaire:
Enregistrer un commentaire