Thứ Năm, 5 tháng 12, 2024

Javascript Thẻ A

Typical Bind Method

Normal link:

<a href="https://www.google.com/">Google<a/>

And something like this for JS:

$("a").click(function (e) {
    e.preventDefault();
    var href = $(this).attr("href");
    window.open(href);
    return false;
});

The benefits of this method are clean separation of markup and behavior and doesn't have to repeat the function calls in every link.

Link: Xem tại đây

Không có nhận xét nào:

Đăng nhận xét