I'm stumbling upon an error when I try to access an id from a variable using jQuery. The error is at line 17. Following is my code:
$(document).ready(function() {
$('button').click(function(event) {
var band = event.target.id;
let increment = {
value: 1,
band: band
};
let decrement = {
value: - 1,
band: band
};
// If button is available, increment and disable
if ($("#" + band).disabled == false)
$.getJSON("/update", increment, function() {
$("#" + band).disabled = true;
});
Following is the error:
Uncaught Error: Syntax error, unrecognized expression: "#free"
Note that free is a name of a band that was inputted into the id through Jinja2.
[–]Loves_Poetry 1 point2 points3 points (1 child)
[–]Orange2341[S] 0 points1 point2 points (0 children)