summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorJannik Schönartz2018-03-27 09:56:38 +0200
committerJannik Schönartz2018-03-27 09:56:38 +0200
commita172e901631b5d9f98f2b45d90f7ee17e89d3fc4 (patch)
tree06ca24103aedb4295962eb92f898cc29bb8ab268 /modules-available
parent[usb-lock-off] Added successfully edit message and a redirect to the configur... (diff)
downloadslx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.tar.gz
slx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.tar.xz
slx-admin-a172e901631b5d9f98f2b45d90f7ee17e89d3fc4.zip
[usb-lock-off] Removed warnings in JS/JQuery
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/usblockoff/templates/usb-edit-rule.html26
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() {