Grow your CSS skills. Land your dream job.

jQuery – Oups, something’s wrong

  • # December 16, 2009 at 6:04 am

    Hi everyone,

    Here is my problem

    In my new app, you have empty div where you can add an app. When I click on Add an App, a popup fade in and let you choose. The user choose his app, and the link to the app is then clone into the div. Until there, everything is okay. But when you erase the content of the div, if you re-click on Add an App, it duplicates the link added into the div (is it clear?).
    I know something is wrong in the second part of the code, when the user select his app. Because the eraser works perfectly. Could you please help me?

    Here is the code

    Code:
    $(document).ready(function()
    {
    $(‘b.close’).click(function()
    {
    $(this).parent().addClass(‘empty-app’);
    $(this).prev(‘a’).remove();
    });

    $(‘.add-app’).click(function()
    {
    var linkClicked = $(this);

    $(‘#app-store’).fadeIn(function()
    {
    $(‘#app-store a’).click(function()
    {
    var userChoice = $(this);
    var titleUserChoice = $(userChoice).attr(“title”);
    var hrefUserChoice = $(userChoice).attr(“href”);
    var appDivSelected = $(linkClicked).parent();
    $(appDivSelected).removeClass(‘empty-app’);
    $(userChoice).attr(“href”, titleUserChoice).attr(“title”, “”).clone().prependTo(appDivSelected);
    $(‘#app-store’).fadeOut();
    return false;
    });
    });
    });
    });

    # December 16, 2009 at 10:14 am

    Do you have a live site somewhere that we could look at?

    # December 16, 2009 at 10:38 am

    Yes, but only by DM, I’m sorry, because it’s the next product we’re working on. I send you one right now. Sorry for the inconvenience.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".