I am trying to add controls dynamically using javascript add button. It is working fine with simple strings in javascript as follows:
var input="";
input2 = "<select name='parameterUniversity["+ updated_row_num +"]' id='ddl_university'>";
for(i=0;i<10<i++)
input += "<option value='"+i+"'>" + i + "</option>";
input+="</select>";
but when i try to use
var input="";
input = "<select name='parameterUniversity["+ updated_row_num +"]' id='ddl_university'>";
<% @Universites.each_with_index do |u| %>
input += "<option text='" +<%= u.University %>+ "' value='" + <%= u.id %> + "'>" + <%= u.University %> + "</option>";
<% end %>
input+="</select>";
it submits the page when i click on Add button, please let me know what i have done wrong. it should work as we are replacing simple string with this server type string.
Edit Error in console is
SyntaxError: missing ; before statement
i am unable to locate this error
Regards.
@Universites.each do |u|
, also the first letter on a variable as capital is wrong, it should be@universites
and lastly the plural for university is universities.