lieslmaduro Posted October 18, 2020 Share Posted October 18, 2020 Site URL: https://www.angeliquemartina.com/home Hi, I've created a custom social link (a search icon) to appear in a Squarespace 7.1 site header. But these social links are set to automatically open in a new tab. I would like the Search ico n (only this one) to open in the same tab. Hope there is someone out there with the solution! Link to comment
lieslmaduro Posted October 19, 2020 Author Share Posted October 19, 2020 So far, this is what I've come up with. But it targets all social links (not only the search icon link) <script> $(function(){ $('[target]').attr('target', '_self'); }); </script> Link to comment
Solution paul2009 Posted October 19, 2020 Solution Share Posted October 19, 2020 14 minutes ago, lieslmaduro said: It targets all social links (not only the search icon link) If you only want your code to apply to the /search link, you could simply change it to: $(function(){ $('a[href$="/search"]').attr('target', '_self'); }); Improve your online store with our extensions.About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. Content: Links in my posts may refer to SF Digital products or may be affiliate links.Catch up on all the release notes and announcements 2023 [for Circle members only] (there's a public version here)Buy me a coffee Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment