In my code, i have an option button collection as this. I want in my javascript file to execute a function when option is changed.
<div class="col-sm-8 user-type" >
<%= f.collection_radio_buttons :team_account_type, [ ['admin', 'Administrator'], ['team_leader', 'Team Leader'], ['standard_user', 'Standard User']], :first, :last, checked: ['standard_user', 'Standard User']%>
</div>
my js file
$('#team_account_type').on('change', function() {
console.log("i have selected team leader")
});
But it is not working. when i click on the different options, it doesnt catch it or recognize it. Any help appreciated.
Thanks