我想在单击具有名为“ update2”的类的按钮时模糊模式背景。目前这就是我正在做的事情。我不确定为什么它不起作用。
用于模糊正文的jQuery代码
$(".update2").on("click", function() {
// State changes
$("body").addClass("blur-filter");
});
HTML
<html>
<head>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
</head>
<body onload="my_entrys()">
<div id = "entryOne" class = "entries">
<table>
<tr>
<td><button id = "entryButton1" onclick="view_entry(${entry.id})" class = "update2">View</button></td>
<td><button id = "entryButton2" onclick="edit_entry(${entry.id})"class="update2" >Edit</button></td>
<td><button id = "entryButton3" onclick="delete_entry(${entry.id})"class="delete" >Delete</button></td>
</tr>
</table>
</div>
</body>
</html>
CSS
.blur-filter {
-webkit-filter: blur(2px);
-moz-filter: blur(2px);
-o-filter: blur(2px);
-ms-filter: blur(2px);
filter: blur(2px);
}