April 17, 2012
Slide upping in jquery with ids
Question by Mert Metin
var Ids = $('.head:has(:checkbox:checked)')
.map(function() { return this.id })
.get(); alert(Ids);
i have ids with above code.However,
i cannot slide up with these Ids with
Why this does not work ?
function(response){
alert("Başarıyla silindi");
$('#'+Ids).each('slow', function() {
}).slideUp();
Answer by Starx
First of all Ids
is an array, so you cannot directly use $("#"+Ids)
.
Next, even if Ids was not an array and referrred to a string variable $("#"+Ids)
would return an HTML element
, which does not have .each()
function.
The correct way to do this is
$.each(Ids, function(v) {
$("#"+v).slideUp("slow"):
});