Grow your CSS skills. Land your dream job.

Grab content of a div

  • # May 19, 2010 at 1:50 pm

    Hey I’m not sure if there’s a way to do this but basically I have a div and its content is generated by user interaction. So I want to be able to grab what is in the div (I’m hoping to give the option to save the div contents to a database when a user clicks a save button). So basically I’m looking for a function to grab the text contents of a div.

    Hope that makes sense!

    Thanks you!

    # May 20, 2010 at 5:40 am

    If you’re using jQuery, you could get the contents by doing this:

    Code:
    $(document).ready(function() {

    $(“div#example”).text();

    });

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

You must be logged in to reply to this topic.

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