var selector = '#Id-value_' + index;
var exist = $(selector).exists();
Bu kod parçası için hata alıyorum.
Belgem hazır fonksiyon
$(document).ready(function() {
});
var selector = '#Id-value_' + index;
var exist = $(selector).exists();
Bu kod parçası için hata alıyorum.
Belgem hazır fonksiyon
$(document).ready(function() {
});
jQuery hiçbir exists()
işlevi yoktur olduğunu. Ama çabuk birini yazabilirsiniz: o $(selector).length
kullanarak varsa
//add a new function to jQuery
jQuery.fn.exists = function(){return this.length>0;}
//now let's test it
if ($(selector).exists()) {
// Do something
}
@ K48 cevap dayanarak, aynı zamanda doğrudan kontrol edebilir.
var selector = '#Id-value_' + index;
if ($(selector).length) {
// Do something
}