Quasilinear Thoughts

- A developer's log book.

Published on

How to execute jQuery or Javascript inside a blogger blog post

Authors

How to run JavaScript/jQuery code in my Blogger article was a question I had on my mind for a very long time. After doing some investigation, I discovered how to run the script inside a Blogger post.

Blogger post editor allows to add inline HTML code for markup, we are going to use this feature to achieve our goal.

  • Create a blogger post, by clicking New Post on Blogger dashboard.
  • Give your post title.
  • On WYSIWYG editor, click on the Pencil button and select the HTML view.
  • Insert your JavaScript/jQuery code inside script tag.
    E.g :

Sample Script :

function moveRight(){
        $("#b").animate({left: "+=300"}, 2000,moveLeft)
    }

function moveLeft(){
        $("#b").animate({left: "-=300"}, 2000,moveRight)
    }

$(document).ready(function() {

       moveRight();

});

Comments are closed but If you want to respond, please send me a message over WhatsApp or facebook or tweet or send email.

Khalil

Khalil Ganiga

Just another programmer.. This blog expresses my views of various technologies and scenarios I have come across in realtime.

Keep watching this space for more updates.