2

I have a string variable having data

4096;jpg,bmp

or

2048;flv,mpg

I want to split this string into two string in jquery on the basis of ;

1
  • 1
    You should learn about the difference between JavaScript and jQuery. jQuery is just a library focused on manipulating a web page. Simple operations like this are done directly in JavaScript. Commented Jul 21, 2010 at 9:52

2 Answers 2

3

You can use JavaScript's split function.

var some_text = "blah;blah;blahness";
var arr = some_text.split(';');
alert(arr[2]); //blahness
Sign up to request clarification or add additional context in comments.

Comments

1

here is some code..

var str = '4096;jpg,bmp';
var elements = str.split(';');

alert( elements[0] ); // 4096
alert( elements[1] ); // jpg,bmp

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.