jQuery – get values inside parentheses


jQuery – get values inside brackets..

If the first part of a string is a fixed length, you can avoid complicated procedures entirely using slice():

var str = "JAINISH (143.50) SENJALIYA ";
    pos = str.indexOf("(") + 1;

 alert(str.slice(pos, -1));

 alert(str.slice(pos, str.lastIndexOf(")")));
//-> "143.50"

If you have any query then feel free to contact me at Jainish Senjaliya

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s