Grow your CSS skills. Land your dream job.

[Solved] Add Class to Parent if Checkbox is Checked

  • # December 30, 2011 at 9:09 am

    This code: $(this).parent().length points to the parent of the link, which is the LI. Try this (demo):

    $(this).parent().siblings().length;

    Or this would work too, but a bit more messy

    $(this).parent().parent().find('li').length;

    It uses .parent().parent() instead of .closest('ul,ol') since I’m not sure it works and I’m too lazy to test it.

    # December 30, 2011 at 9:31 pm

    You’re alien Mottie… http://jsfiddle.net/tovic/3DMue/34/

    This will be the last question: How do I unwrap the from text? I’ve tried it but did not succeed:

    realContent.find('.sortable p span').contents().unwrap();

    I add this code to increase the paragraph too:

        $('a.pplus').live("click", function(){
    var paragraph = $('textarea#pg').val();
    $(this).parent().before(' ' + $.trim(paragraph) + '');
    return false;
    });

    $('a.pminus').live("click", function(){
    $(this).parent().prev().remove();
    return false;
    });

    Example: http://stackoverflow.com/questions/2308366/remove-element-with-jquery-but-leave-text

    # January 1, 2012 at 3:40 am

    Nevermind. It solved HAHA :D

    realContent.find('span.p').contents().unwrap();
    # January 1, 2012 at 11:07 pm

    Mottie, check what you created with javascript :D

    Lipsum-UI - A JQuery UI Lorem Ipsum Generator
    Lipsum-UI

    # January 1, 2012 at 11:22 pm

    @Hompimpa I’m getting all sorts of malware warnings when attempting to view that site.

    # January 2, 2012 at 1:06 am

    what??? I din’t do anything. Is getting all sorts of malware warnings a metaphore?

    # January 2, 2012 at 1:12 am

    # January 2, 2012 at 1:26 am

    Oh, that image. It is simply a banner image. Not a virus. I am a follower of that friendship communities. I’ll try to get rid of it. But HERE IS NOTHING HAPPEN T_T

    How about now?

    # January 2, 2012 at 8:58 am

    Ok, it’s fine now… nice work, but I think it would be better to have it online instead of making people download the files. You know, at the top of the jsFiddle page is a Share button that has a link to a full page demo.

    Also, since you’re using jQuery UI, you might was to include the stylesheet – http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css – Just add it under the “Add Resources” tab.

Viewing 10 posts - 31 through 40 (of 40 total)

You must be logged in to reply to this topic.

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