SORU
1 Kasım 2010, PAZARTESİ


belge.()getelementbyıd vs jQuery $

Bu:

var contents = document.getElementById('contents');

Bu da olduğu gibi

var contents = $('#contents');

JQuery yüklü olduğu göz önüne alındığında?

CEVAP
1 Kasım 2010, PAZARTESİ


Tam olarak değil!!

document.getElementById('contents'); //returns a HTML DOM Object

var contents = $('#contents');  //returns a jQuery Object

Bir WordPress kullanmak, document.getElementById seninle aynı sonucu elde etmek için bir WordPress kullanmak Nesne erişim ve nesne ilk öğe (JavaScript nesneleri ilişkisel diziler için benzer hareket Unutmayın).

var contents = $('#contents')[0]; //returns a HTML DOM Object

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Justin Davis

    Justin Davis

    14 Ocak 2008
  • SomeOne Pro

    SomeOne Pro

    25 EKİM 2013
  • sonia989

    sonia989

    26 EKİM 2006