I am trying to replicate this HTML code
<input type="checkbox" value="" id="2" name="check" />
<label style="left: 0px;"for="2"><span>Name</span>
using this Ruby On Rails 4 code
<%= check_box_tag 'reason_ids[]', reason.id, false ,:required => true%>
<label style="left: 0px;"for="2"><span>Name</span>
So far I am getting the same visual appearance like HTML produces, but not the same functionality.
My goal: Click on label also checks checkbox.
At this point I can't check checkbox with click neither on checkbox or label. I have tried to change order of Rails code, but without success.
What I am doing wrong ? Thanks.