New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go to link on click OK #168
Comments
The library do not have the option to do that. I modify the constructor in #165 (We need to wait to be approved) for sending an extra param to the constroctor, in this case it will be the link. |
This is actually very simple to achieve. I'm using jQuery in this example. $('a').click(function(e){
e.preventDefault();
var link = $(this).attr('href');
swal({
title: "Are you sure?",
text: "By clicking 'OK' you will be redirected to the link.",
type: "warning",
showCancelButton: true
},
function(){
window.location.href = link;
});
}); This will add the behaviour to all a-tags. If you want it for certain links only, you could add a specific class to the a-tags, and limit the sweetAlert functionality to just them. |
Thanks for you help Tristan, that works perfectly! |
it's not working!Uncaught SweetAlert: Unexpected 2nd argument (function(){
|
Forgive my inexperience. How can I achieve this:
I'd like sweetalert to show a message when a user clicks a link, but then to only go to the link if the user selects 'OK' in the sweetalert dialog.
Thanks!
The text was updated successfully, but these errors were encountered: