From 11b3ae1af569aa2e5a38ede7691590a6571a3724 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Tue, 13 Nov 2018 22:50:54 +0100 Subject: [PATCH] Reset file input when opening new part info. --- parts/static/script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parts/static/script.js b/parts/static/script.js index ae31607..4081da5 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -177,6 +177,10 @@ function show_part_info(partID) { $('table#details tr#description td input').val(text_filter(data.description)); $('table#details tr#notes td p').text(text_filter(data.notes)); $('input[name=notes-input]').val(text_filter(data.notes)); + // Resetting file input. Super dirty hack. Disgusting + var $el = $('#datasheet-finput'); + $el.wrap('
').closest('form').get(0).reset(); + $el.unwrap(); container_onchange(); if (data.datasheet != null) { $('tr#datasheet-head').html($('DATASHEET: ')); @@ -243,9 +247,6 @@ function container_onchange() { } } - - - function octopartFetch(){ $.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){ if (json['result']=='ok'){