I have this button that displays a link. The link is difficult to highlight and copy when on mobile devices. I want to make the link a button that redirects you when clicked
** <%= link_to 'Reply Link', '#', class: "cursor-pointer inline-flex items-center px-4 py-2 border border-transparent text-sm leading-5 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline-indigo focus:border-indigo-700 active:bg-indigo-700 transition duration-150 ease-in-out", "@click" => "showReplyLink = true; return false " %>
**
I would try to use CSS to make a link as button. If You use bootstrap You can add classes: btn btn-primary or write Your own for instance add class button: and write css like here How to create an HTML button that acts like a link
a.button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
text-decoration: none;
color: initial;
}
The second argument to link_to
is the path or URL that you want to link to. Replace the '#'
argument with the URL that you want to redirect to
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.