diff options
author | Jannik Schönartz | 2018-03-27 09:56:38 +0200 |
---|---|---|
committer | Jannik Schönartz | 2018-03-27 09:56:38 +0200 |
commit | a172e901631b5d9f98f2b45d90f7ee17e89d3fc4 (patch) | |
tree | 06ca24103aedb4295962eb92f898cc29bb8ab268 | |
parent | [usb-lock-off] Added successfully edit message and a redirect to the configur... (diff) | |
download | slx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.tar.gz slx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.tar.xz slx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.zip |
[usb-lock-off] Removed warnings in JS/JQuery
-rw-r--r-- | modules-available/usblockoff/templates/usb-edit-rule.html | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/modules-available/usblockoff/templates/usb-edit-rule.html b/modules-available/usblockoff/templates/usb-edit-rule.html index 55cdce0d..e2bc5b65 100644 --- a/modules-available/usblockoff/templates/usb-edit-rule.html +++ b/modules-available/usblockoff/templates/usb-edit-rule.html @@ -31,39 +31,41 @@ <script> var idArray = {{{usbJson}}}; - document.addEventListener("DOMContentLoaded", function(event) { + document.addEventListener("DOMContentLoaded", function() { $('.switch-input').click(function() { var $op = $(this).parent().find('select'); var val = $op.val(); $op.replaceWith($('<input class="form-control" type="text">').attr('name', $op.attr('name')).val(val)); }); - var vid = $('#prop-vid').val(); - var pid = $('#prop-pid').val(); - $('#prop-vid').empty(); + var vendorid = $('#prop-vid'); + var productid = $('#prop-pid'); + + var vid = vendorid.val(); + vendorid.empty(); $('[id^="prop-"]').change(function () { updateAttributes(); }); - $('#prop-vid').change(function () { + vendorid.change(function () { var $this = $(this); var vid = $this.val(); - var pid = $('#prop-pid').val(); - $('#prop-pid').empty(); + var pid = productid.val(); + productid.empty(); $.each(idArray[vid]['products'], function(key, value) { - $('#prop-pid').append($('<option></option>').val(key).html(value)); + productid.append($('<option></option>').val(key).html(value)); }); - $("#prop-pid").val(pid); + productid.val(pid); }); $.each(idArray, function(key, value) { - $('#prop-vid').append($('<option></option>').val(key).html(value['name'])); + vendorid.append($('<option></option>').val(key).html(value['name'])); }); - $("#prop-vid").val(vid); - $("#prop-vid").change(); + vendorid.val(vid); + vendorid.change(); }); function updateAttributes() { |