Click Button to Redirect Using jQuery
To achieve this, you can use the following jQuery code:\n\njavascript\n$(document).ready(function() {\n $(".blgLink").click(function() {\n var link = $(this).data("link");\n window.location.href = link;\n });\n});\n\n\nThis code attaches a click event handler to the button with the class "blgLink". When the button is clicked, it retrieves the value of the "data_link" attribute using the .data() method in jQuery and assigns it to the link variable. Then, it redirects the browser to the specified link using window.location.href.
原文地址: https://www.cveoy.top/t/topic/qx6U 著作权归作者所有。请勿转载和采集!