Jump to content
Chap 6 Magnet
6 replies to this topic
Posted 27 January 2013 - 11:02 PM
Hello and thanks by advance.
I m French so sorry for my poor english
I don't understand what happenened with the code below and nothing is explained about what is doing this part of code.
var $d = $("div"); line20 //$d get now a table of all the divs
$d.addClass("current_hand) // it means that all the div will get the current_hand class ?
.appendTo ("#my_hand"); //the div my_hand will receive all the div with the class current_hand ?? i don't understand what happened
Sometime many things are really well explained and explained with many ways. And sometimes a huge part of code is written without mzny explication.
I 'll be very happy if you could explain me what is doing actually this part of code page 234
Posted 28 January 2013 - 06:56 PM
var $d = $("div"); line20 // here we are creating a new div element and storing it into $d $d.addClass("current_hand") // here we are adding class "current_hand" to the element we stored into $d .appendTo ("#my_hand"); // here we are appending the element $d to a element which has the id #my_hand $("<img>").appendTo($d)
Posted 29 January 2013 - 12:22 AM
Hello and thanks helping me each time
var $d = $("<div>");i don't understand why this command is creating a div instead of select the div. the syntax $("jjjjj") is to select not for create
so $("<img>") mean that we are creating a new image ? In this case i understand better
to conclude how i know if i'm selecting or cretaing $("p") is selecting $("<div>") is creating because of the < and > sign
Posted 29 January 2013 - 03:32 AM
Posted 29 January 2013 - 08:18 AM
i try what we have told
i had this script in the my_scripts.js in order to test if à new <p> had been created with sssss inside.
when i run the index.html file there is no my new p
I put it just under tne .ready function()
burt nothing happened
Posted 31 January 2013 - 07:06 AM
var $B = $("body"); $("<img>").appendTo($<img src='http://forums.oreilly.com/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' />;
you need to append it to some other element like you did before in the above code.
Edited by __Adnan, 31 January 2013 - 07:12 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users