We help IT Professionals succeed at work.

jquery cell size limit

joyacv2
joyacv2 asked
on
141 Views
Last Modified: 2014-08-13
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?
Comment
Watch Question

CERTIFIED EXPERT
Expert of the Year 2014
Top Expert 2014

Commented:
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

Author

Commented:
Hi,

Can you check your jsFiddle address?
CERTIFIED EXPERT
Expert of the Year 2014
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.