PHP Indonesia - Facebook | PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ | |
 | Book your hotel early for a discount!
You can reap the rewards with great discounts at participating Pullman, M Gallery, Grand Mercure, Novotel, Mercure, ibis and Formule 1 hotels.  | From our sponsors | | |
[ask] penggunaan "(this)" pada keterangan coding d... Sep 8th 2013, 08:14, by Fauzi Fauzy | [ask] penggunaan "(this)" pada keterangan coding dibawah ini apa y..?
<script type="text/javascript"> $(document).ready(function(){ $("div").mouseover(function(){
$(this).css({background:"red"}); }); $("div").mouseleave(function(){ $(this).css({background:"yellow"}); }); }); </script> |
| | this untuk element yang terpilih (selector) contoh di atas untuksemua element DIV ketika mouseover atau mouseleave |
| | bukannya selector itu di isi dengan nama tag, id, & class saja? trus kalau diisi dengan this maksudnya ap? |
| | [oot] .."bukannya selector itu di isi dengan ..nama tag, id, & class saja?" really ?NO!
$("div").mouseover(function(){ //jika ada event mouseover pada tag <div> maka.. $(this).css({background:"red"}); // pada selector 'this'(atau selector 'ini', yaitu tag <div>, ubah style untuk property 'background'-nya menjadi 'red' });
FYI:'this' adalah reserved word di native javascript .. cmiiw ^_^V .. ada baiknya belajar juga native javascriptnya.. jquery basic-nya 'kan native javascript juga.. |
| | hm.. terimakasih pak atas ilmunya,, (y) |
| | ya selector yg disebutkan di function
$("div").mouseover(function(){ $(this).css({background:"red"}); });
this = div yg sedang kena event mouseover | | |
|
Tidak ada komentar:
Posting Komentar