Header ads

How to Make Links Using Javascript on Blogger


Hello kevirite friends on this occasion I will share experiences related to finding ways to make links that can be set in the layout and of course it must use Javascripts.

I haven't posted tutorials for a long time, even this blog has fewer visitors compared to when I frequently update posts. This time I will discuss about the javascript caller link that we need. The story I look for this way is from the online store template services that I'm working on.

The current template must be more easily required than the existing template. Just look at Linkmagz, the template has been optimized in such a way that template users don't have to bother customizing the template on the Edit HTML menu.

Even the latest release of the LinkMagz template (updated version 2.6.0-2) has provided a special widget for CSS code and Javascript code in the layout menu.

From here I also have to, one of the obstacles when creating templates from online template services recently is the difficulty in applying href links so that they are easy to replace without going to edit HTML. Indeed in general for href links we can use the LinkList or PageList widget but when we link it must be in addition to the widget then inevitably have to be set manually in the HTML edit menu.

That was my initial assumption, but in my mind there must be another way to manipulate it, yes certainly with the help of javascript. Start searching for tutorials from various sources and finally there is a suitable script to call the link with the variable and attr methods.

Here is the code that I used, where I got this script from the Stack Overflow group

  $ (function () {
    var linkRegistration = 'https://digiartic.com/member/d listed/';

    $ ('a.-follow button'). each (function () {

        $ (this) .attr ('href', Registration link);

    });

});



To see the original script you can check on JSFiddle

For how to create a link using javascript you can see the following tutorial:


  1. blogger login
  2. go to the layout menu  and create a new Javascript / HTML widget
  3. Enter the Javascript code above and don't forget the URL of the blog and the code a. The follow button is changed according to your needs. Click Save first.
  4.  now go to the Themes menu  and click Edit HTML
  5. If you have made the code <a class= 'button-follow'> Link Name </a> after that save the template

Note:

See a.-follow button, the button must be the same as class = 'button-follow' . You can change the code as you wish and need.

Also see the link https://digiartic.com/member/d listed/, don't forget to replace the link with the Url blog as you wish and need.

If you want to create links using more than one javascript, then all you need to do is replace the  Registration link  with another name as you wish and need to avoid javascript conflicts.

Maybe most of you have seen the script code, or maybe most have never seen and confused with this tutorial that I made. Indeed this tutorial is intentionally made like this and aims for just a reminder so that later if you need the script code is no longer looking for in various sources.

Thank you for reading the tutorial on How to Make Links Using Javascript on Blogger , hopefully it will be useful.

Post a Comment

0 Comments