Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  32] [ 7]  / answers: 1 / hits: 36033  / 13 Years ago, mon, september 12, 2011, 12:00:00

i've this problem i'm not really able to solve.



i have this string B01, B20, B03,



i would like to create a jQuery array off this string using the , as delimiter
then remove the last element ( that would be blank ) and then for each value of the
array make an alert.



Something like...



 var theString = B01, B20, B03, ;

var theArray = (theString, ',');

theArray = remove_last_element; (??)

$('theArray').each(function() {

alert(theArray[?].value);

});


Any hint ?



Thanks !


More From » jquery

 Answers
9
var theString = B01, B20, B03, ;

$.each(theString.split(,).slice(0,-1), function(index, item) {
alert(item);
});


Let me know if you have any questions.


[#90147] Friday, September 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
karyme

Total Points: 545
Total Questions: 102
Total Answers: 120

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
;