Link to home
Start Free TrialLog in
Avatar of joyacv2
joyacv2Flag for Puerto Rico

asked on

jquery cell size limit

Hi,

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?
Avatar of Gary
Gary
Flag of Ireland image

http://jsfiddle.net/GaryC123/78Lp2w5w/

$("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).hide()
    $(this).next().css("display", "inline").show()
})

Open in new window

Avatar of joyacv2

ASKER

Hi,

Can you check your jsFiddle address?
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial