www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to insert JavaScript in a Wordpress page?

Hybrid View

  1. #1
    Join Date
    Aug 2013
    Location
    Denmark
    Posts
    1

    Unhappy How to insert JavaScript in a Wordpress page?

    Hi all,

    does any of you have experience of getting a Javascript up and running in a single Wordpress page - ie. not all over the blog, only on one page/post?

    I've got this small javascripted piece here:
    http://bjerreandersen.dk/kom/kompetence.htm

    - when you click on the blue words, some more text folds out.

    The code on the html-version (despite the CSS) goes:

    Code:
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
            <script>
                $(function () {
                    $('#intro').each(function () {
                        $('span.romance-toggle').on('click', function () {
                            var _this = $(this);
                            if (_this.hasClass('clicked')) {
                                $('#romance-' + _this.attr('rel')).hide();
                                _this.toggleClass('clicked');
                            } else {
                                $('#romance-' + _this.attr('rel')).fadeIn(500);
                                _this.toggleClass('clicked');
                                
                            }
                        });
                    });
                    
                });
            </script>
    that just won't work in Wordpress ... at least not when I try with all the hacks I've been able to look up in threads, only making me more confused.

    I'm a JavaScript newbie - so if anyone could give me a walkthrough on how to make this function in Wordpress, I would really appreciate it!

    frederik

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,672
    Quote Originally Posted by bjerreandersen View Post
    ...
    I've got this small javascripted piece here:
    http://bjerreandersen.dk/kom/kompetence.htm
    ...
    404 Site Error.

    No results were found for the requested page or post.

  3. #3
    Join Date
    Aug 2013
    Posts
    1
    Yes. I have done this before. If you put it in the non-visual editor of the page, that may help. Also try installing the CJT plugin, which I believe is free. If you want help, respond and I will see what I can do.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles