Toggling hover on dropdown between mobile and desktop
Instead of removing the attribute completely, you could reassign it to nothing like so:
$('.dropdown-toggle').attr('data-hover', '');
If there is no value assigned to the attribute, it shouldn't do anything.