I am entering the String either by comma separated or by clicking on enter key .. What i want to do is , i have separate the string with either , or /n separated with respective to input.. How to do it . Can anyone help me out to solve this problem
My approach :
var str = $("#textValue").val(); { "hel,asda,asdasd,asdasd" }
var array = new Array();
array = emailString.split(',');
The above is the case when user gives input with comma separated. We dont know whether the user gives either comma separated or not.He may click on enter and give inputs. whats the solution on that scenario. Please help me out to solve this
If the comma based split gave only one element, try a new line split :
var str = $("#textValue").val();
var array = new Array();
array = emailString.split(',');
if (array.length == 1) {
array = emailString.split('\n');
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments