Reputation: 1401
I have checkboxes like this:
<input type="checkbox" value="1500-374-Breckin Meyer" id="artistBreckin Meyer" class="ImdbAddArtist" name="artist[]">
var exploded = value.split('-');
$("#" + par2 + "").append(('<br /><input type="checkbox" name =' + par + ' value=' + exploded[0] + "-" + exploded[1] + '-' + exploded[2] + ' />' + exploded[3] + '<br />'));
$('#artist' + exploded[3]).slideUp('slow');
It adds my div but the following line doesn't work:
$('#artist' + exploded[3]).slideUp('slow');
Can anyone tell me why?
Upvotes: 0
Views: 57
Reputation: 15916
You are using the character -
as a split separator, and the string you are splitting is 1500-374-Breckin Meyer
. Given your code, this would produce an array of the strings 1500
, 374
and Breckin Mayer
.
In other words, you have 3 elements (index 0 to index 2) in the resulting array of strings/segments.
However, as shown below you are referring to a fourth segment (index 3).
exploded[3]
Upvotes: 2