Is it possible to explode datas in array according to a charachter?
.each(myArr, function(key, value) {
});
i take array like that
value is the values of array . Can explode value with "-" ?
Answer: Use the JavaScript split() method If you want to explode or split a string from a certain character or separator you can use the JavaScript split() method. The following example will show you how to split a string at each blank space. The returned value will be an array, containing the splitted values.
each(), which is used to iterate, exclusively, over a jQuery object. The $. each() function can be used to iterate over any collection, whether it is an object or an array. In the case of an array, the callback is passed an array index and a corresponding array value each time.
Use split()
:
var items = value.split('-');
You can use split
var arr = str.split('-');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With