script.js
21 lines
| 1 | (function ($) { |
| 2 | $(document).ready(function () { |
| 3 | /* add notice about changing in the settings page */ |
| 4 | $(document).on('click', '.rewrite_add_item', function () { |
| 5 | $(this).each(function () { |
| 6 | if ($(this).prev().val() != '') { |
| 7 | $(this).next().hide(); |
| 8 | $(this).parents('.rewrite_new_item').removeClass('rewrite_new_item').clone().addClass('rewrite_new_item').appendTo($(this).parents("td")).find('input').val(''); |
| 9 | $(this).addClass('rewrite_delete_item').removeClass('rewrite_add_item'); |
| 10 | } else { |
| 11 | $(this).next().show(); |
| 12 | } |
| 13 | }); |
| 14 | }); |
| 15 | $(document).on('click', '.rewrite_delete_item', function () { |
| 16 | $(this).each(function () { |
| 17 | $(this).parent().remove(); |
| 18 | }); |
| 19 | }); |
| 20 | }); |
| 21 | })(jQuery); |