1

I have a div:

<div id="crop"><span> text - 123 views</span></div>

I want crop from "-" to "v" ,thanks

migrated from wordpress.stackexchange.com May 15 '11 at 19:19

This question came from our site for WordPress developers and administrators.

  • 1
    can you explain what you are wanting to do a little better. The term crop is to remove something like crop an image but i do not quite get crop from - to v. Also is the div user created or wordpress plugin core created. – xLRDxREVENGEx May 13 '11 at 3:47
1

http://jsfiddle.net/8Wqr3/

var $span = $('#crop').find('> span');

$span.text(
    $span.text().replace(/^[\s\S]*-\s+(\d+)\s+[\s\S]*$/m, '$1')
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.