edward edward - 3 months ago 7x
Javascript Question

I need to get a certian part out of a string using Jquery

I need to get the

part out of the following elements alt attribute

<img src="http://www.test.com" class="img-thumbnail" alt="John Smith (jsmith)">

So I'm running this


which gives me

"John Smith (jsmith)"

I need to get the 'jsmith' part out

any ideas?


Try this


Please note that this will only work if you want to get the text inside brackets. FIDDLE. Hope this helps