diff --git a/parts/static/script.js b/parts/static/script.js index 455cccf..d58a40d 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -16,14 +16,19 @@ function init_edit(partID) { $('table#details tr#datasheet td input').show(); $('#duplicate-button').closest('div').hide(); + $('#delete-button').closest('div').hide(); $('tr#datasheet').show(); $('input[name=notes-input]').show(); $('table#details tr#notes td p').hide(); - var newButton = '
'; - $('.round-button-left').replaceWith(newButton); + // var newButton = '
'; + // $('.round-button-left').replaceWith(newButton); + $('#edit-button').html(''); + $('#edit-button').off('click').on('click', function(){ + save(partID); + }); } function new_entry() { @@ -61,9 +66,11 @@ function end_edit() { $('table#details tr#notes td p').show(); $('#duplicate-button').closest('div').show(); + $('#delete-button').closest('div').show(); - var newButton = '
'; - $('.round-button-left').replaceWith(newButton); + $('#edit-button').html(''); + // var newButton = '
'; + // $('.round-button-left').replaceWith(newButton); } function save(partID) { @@ -196,7 +203,7 @@ function show_part_info(partID) { $('tr#datasheet-head td').text('DATASHEET: '); $('input[name=datasheet-url-input]').val(''); } - $('#edit-button').click(function() { + $('#edit-button').off('click').on('click', function() { init_edit(partID); }); $('#delete-button').off('click').on('click', function() {