'jQuery selection is not working for addClass but is for hasClass
I am not sure why the jQuery is not adding the class "taken" to the div following the input in the following html:
<div id='location-inventory'>
<input type="text" class='bin_number_input'>
<div></div>
</div>
In the following jQuery, the console.log is being activated but the addClass is doing nothing.
jQuery:
$('#location-inventory').on('keyup','.bin_number_input',function(){
if(!$(this).next().hasClass("taken")){
console.log("can update"); // <- this is working
$(this).next().addClass("taken");
}else{
How would I make it so that the div becomes <div class='taken'></div>?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
