Seperate javascript
This commit is contained in:
parent
3a4c45a4eb
commit
8265004df5
2 changed files with 16 additions and 13 deletions
16
app/assets/javascripts/remove_dagschotel_button.js
Normal file
16
app/assets/javascripts/remove_dagschotel_button.js
Normal 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);
|
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue