WordPress.org

Ready to get started?Download WordPress

Forums

How to call Javascript inside sidebar? (2 posts)

  1. koks
    Member
    Posted 5 years ago #

    Hi,

    I want to have apop-up message when users click on a buton in sidebar. So I create a javascript file named prob.js:

    // JavaScript Document
    function disp_alert()
    {
    alert("Cool");
    };

    then I add this code to header.php:

    <script src="/javascript/prob.js" type="text/javascript"></script>

    after that, i add to the top of the sidebar.php file:
    <?php get_header(); ?>
    But nothing happens! I wonder how can I call it then!!

    Thanks in advance!

  2. jbbrwcky
    Member
    Posted 5 years ago #

    Surely your get_header() call is being made somewhere else, i.e., the index.php? If sidebar is included in the index file, it should already have the javascript.

    What is your html code for the link where the button is clicked?

Topic Closed

This topic has been closed to new replies.

About this Topic