Seperate javascript

This commit is contained in:
tl3ilaxu 2016-03-02 23:11:37 +01:00
parent 3a4c45a4eb
commit 8265004df5
2 changed files with 16 additions and 13 deletions

View file

@ -0,0 +1,16 @@
ready = function() {
var id = $("#remove_dagschotel").find(".btn");
default_value = id.val();
id.hover(function() {
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
$(this).val("Remove dagschotel");
}, function() {
$(this).val(default_value);
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
});
}
$(document).ready(ready);
$(document).on('page:load', ready);

View file

@ -1,15 +1,2 @@
= content_for :title, "Choose new Dagschotel"
= render 'products/index'
= javascript_tag do
var id = $("#remove_dagschotel").find(".btn");
default_value=id.val();
id.hover(function () {
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
$(this).val("Remove dagschotel");
}, function(){
$(this).val(default_value);
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
});