var selectedCustomers = document.getElementById("hfCustomerID");
output :- "|1|2|3"
this is my hidden field in which pushed value stored.
values in hidden field are stored "|1|2|3" like this
because of this when string is split and pushed in array at index 0 = "" is stored.
how to check and remove First "|" from string in jquery before pushing it to array?
最佳答案
"|1|2|3".slice(1).split('|');
使用 slice() 删除第一个字符。
"|1|2|3".match(/[^|]/g);
或使用正则表达式
关于javascript - 如何从 jquery 中的字符串中删除第一个文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44176470/