I have this form:
<%= form_for(@post) do |f| %>
<%=f.collection_select :post_id, Board.where(:user_id => current_user.id), :id, :name %>
<%= f.submit "Post it"%>
<% end %>
I want to know how add new option without reload page with input button through jquery:
I want add the option to collection_select before submit form
I’m using jquery ujs https://github.com/rails/jquery-ujs
Example:

if the option you want to add is already on the page this post has the answer.
if you wanted to do it with ajax you would need to get the options though a call to ajax to get the array then iterate over it
update:
change append to prepend if you want it at the top which might be a bit more user friendly
the replace element might need work depending on what the users are likely to input and how you want to store the new options.
and was not sure how you wanted to fire this, so you need to bind it to the create i guess…