diff --git a/app/assets/javascripts/exercise_collections.js.erb b/app/assets/javascripts/exercise_collections.js.erb index c1995c7e..d1c4aae8 100644 --- a/app/assets/javascripts/exercise_collections.js.erb +++ b/app/assets/javascripts/exercise_collections.js.erb @@ -170,6 +170,15 @@ $(function() { } } }); + + $('.remove-exercise').on('click', function (e) { + e.preventDefault(); + + var row = $(this).parent().parent(); + var exerciseId = row.data('id'); + $('#exercise-list').find('option[value="' + exerciseId + '"]').prop('selected', false); + row.remove() + }); } } });