I am trying to change the data-depth of a div with a new class but it won't change really need help here, would appreciate if someone could help
here is my code
$('div.new').data('depth') === 1.00;
I am trying to change the data-depth of a div with a new class but it won't change really need help here, would appreciate if someone could help
here is my code
$('div.new').data('depth') === 1.00;
 
    
     
    
    You're trying to use the comparison operator to set the value, which won't work.
In addition, $('div.new').data('depth') retrieves the data-depth attribute value, you can't actually set it even if you use the = operator.
Depending on your jQuery version, you could use $('div.new').data('data-depth', 1.00) to set the value. However, it is probably safer to use the .attr() method, since the .data() method won't always work when setting a value.
$('div.new').attr('data-depth', 1.00);
 
    
    