Вы можете использовать jQuery-метод removeAttr() для удаления атрибутов из элемента HTML.
В следующем примере, когда вы нажимаете кнопку «Удалить ссылку», он удалит атрибут href из ссылки. Давайте посмотрим, как работает этот метод:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Removing Attribute from HTML Element</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function() {
$(".remove-attr").click(function(){
$("a").removeAttr("href");
});
});
</script>
</head>
<body>
<button type="button" class="remove-attr">Удалить ссылку</button>
<a href="#">Demo Link</a>
</body>
</html>















