Commit ad8d587b authored by royce-matthew's avatar royce-matthew

Added Javascript for displaying a preview in the form partial for the candidates edit/new

parent 7678ff3e
......@@ -3,8 +3,19 @@
<%= simple_form_for([:admin, @candidate]) do |f| %>
<%= f.association :position, label_method: :name, value_method: :id %>
<%= f.input :first_name%>
<%= f.input :last_name%>
<%= f.input :image_link%>
<%= f.input :last_name %>
<div class="" id="box"></div>
<%= f.input :image_link, input_html:{id:"field"}%>
<%= f.input :slogan%>
<%= f.submit %>
<script>
field = document.getElementById("field");
box = document.getElementById("box");
field.addEventListener("keyup",function(f)
{
box.innerHTML="<div style='background:url("+field.value+"); height:100px; width:100px; background-size:cover; border-radius:50%' ></div>"
})
</script>
<% end %>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment