Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 955147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:20:03+00:00 2026-05-16T00:20:03+00:00

This is probably a noob question, but how I’ve implemented the appendTo() function below

  • 0

This is probably a noob question, but how I’ve implemented the appendTo() function below doesn’t work as expected. Basically, it added the element and instantly removed it again. It’s blink and you miss it stuff.

Can anyone understand why this might be happening?

Here’s where the function gets called:

<?php foreach ($words as $word) {
echo    "<li class='$word[0]'><a href='' onclick='add_to();'>$word</a></li>";
} 

And here’s the function itself (pretty much taken from the jQuery tutorial site:

function add_to () {
        $('<h1>Test</h1>').appendTo('.ad_text');
    }

My first thought is that a script that calls document.ready() is called, which wipes out the add_to() function? That script is above add_to(), and is this:

$(document).ready(function(){

        //when a link in the filters div is clicked...
        $('#filters a').click(function(e){

            //prevent the default behaviour of the link
            e.preventDefault();

            //get the id of the clicked link(which is equal to classes of our content
            var filter = $(this).attr('id');

            //show all the list items(this is needed to get the hidden ones shown)
            $('#content ul li').show();

            /*using the :not attribute and the filter class in it we are selecting
            only the list items that don't have that class and hide them '*/
            $('#content ul li:not(.' + filter + ')').hide();

        });

    });

Possibly a conflicting bit of code there? Sorry – new to Javascript, and trying to cobble something together quickly.

TIA, Andy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:20:03+00:00Added an answer on May 16, 2026 at 12:20 am

    Your link is reloading the page.
    Try this (added # to the href attribute)

    foreach ($words as $word) {
        echo    "<li class='$word[0]'><a href='#' onclick='add_to();'>$word</a></li>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 503k
  • Answers 503k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If I'm interpreting what you're saying correctly, you want to… May 16, 2026 at 2:49 pm
  • Editorial Team
    Editorial Team added an answer Use your Exchange Server's IP as the STMP server in… May 16, 2026 at 2:48 pm
  • Editorial Team
    Editorial Team added an answer The user's email address can not be retrieved via the… May 16, 2026 at 2:48 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is probably a noob question, but I can't seem to find the answer.
This is probably a java noob question but here is my scenario: using selenium,
sorry for the (probably) noob question, but I', new at this stuff. i have
This is probably a really dumb/noob like question but what is the best method
This is probably a noob question that I will get slated for but here
Probably a noob question but interop isn't one of my strong points yet. Aside
I realise this is an incredibly noob question, but I've googled for it and
This is probably simple but I do not seem to get it to work.
This is probably easy, but I couldn't find an answer anywhere. I'm filling a
This is probably something simple but it's driving me nuts. I'm making some pagination

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.