Get a free trial // 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):


    Or this would work too, but a bit more messy


    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…

    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(){
    return false;


    # January 1, 2012 at 3:40 am

    Nevermind. It solved HAHA :D

    # January 1, 2012 at 11:07 pm

    Mottie, check what you created with javascript :D

    Lipsum-UI - A JQuery UI Lorem Ipsum Generator

    # 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 – – 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.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed