jquery cell size limit

Posted on 2014-08-13
Last Modified: 2014-08-13

I have a table with multiple cells, i want the cells that have more than 25 characters, appears only the first 25 characters and a word that says more info..., then when the user press the button, appear the rest of the information of the cell, any idea?
Question by:joyacv2
    LVL 58

    Expert Comment


    $("td").each(function () {
        if ($(this).text().length > 25) {
            $(this).html($(this).text().substr(0, 25) + "<span>...more&nbsp;info</span><p>" + $(this).text().substr(25) + "</p>")
    $(document).on("click", "td span", function () {
        $(this).next().css("display", "inline").show()

    Open in new window

    LVL 1

    Author Comment


    Can you check your jsFiddle address?
    LVL 58

    Accepted Solution

    I think jsfiddle is going a bit doolally

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    Join & Write a Comment

    Suggested Solutions

    To Start with ... One of the most annoying things in developing web pages is handling the 'Enter Key' for form submission. The 'Enter Key' makes form submission so easy that the user always tend to use it. The easiest and the most intuitive way …
    I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now