Home  >  Article  >  Web Front-end  >  jquery method of splitting string_jquery

jquery method of splitting string_jquery

WBOY
WBOYOriginal
2016-05-16 15:52:581119browse

The example in this article describes how jquery splits strings. Share it with everyone for your reference. The details are as follows:

1. Question:

The returned data is a string separated by the special character @sss@vvv. How to return it to 2 IDs
$("#a").text(data)
$("#b").text(data)
How to make them display at the same time, corresponding to the two parts of the string, a corresponds to sss, b corresponds to vvv

2. Solution:

var arr = 'sss@vvv'.split('@');
$("#a").text(arr[0]);
$("#b").text(arr[1]);

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn