0% found this document useful (0 votes)
40 views

JS DOM Lec 1 Notes

java script notes-1

Uploaded by

divyanshu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
40 views

JS DOM Lec 1 Notes

java script notes-1

Uploaded by

divyanshu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
DOM + MODERN TS Window A windew vepreserts an open wirdew: i a brewaer. TH Ww oa qe okjet + TH tw created by the lovowAcy Window LYN Dom BoM TS Cove DOM (Document Object Mecle|)) Whn a welopage Vs. loodled, dre browser creates a Dom ci onneae WT™L DOM Ww a cree Ike Atructuye. COOH OHOTH OS STOHOHOOEOOEO OOS EEECRS evvovebvoese W | » . = The HTML DOM Decuments =k The Docomant Obpect > The dowment fect is tha woot node | the BTML dowmot => He dowmnt shject Mm & property 4 he Window olopeck > Te document weet WA aceOsed with + Wivdlew.decument oy at ckcument Converting the. whole - UTML coole int” thy Is safest. %& catledl DocumENT anol this Model is -' Known 6S DOM. Revderiy 4 Dom Characters, 5 —> tokens —snodeA Cx Dem Se DOM Methods (to. acces clemarts,) (Makig chang wn HTML 7) ts ) ATMEL «DOM methods ane — acettens you an Peron Lon HTML elements) ae The qe Crement By TEAL Meethes| The. mowst. commen voary to aces an HTML clammnt wy to une the id’ 4 tha elanont Exns getElement aa! tod) ecoments xe ClonartBy TA Ueortert') ; > TH w& wild on documart elgjeat « > Tt retum a single abject betouse it works Ww TD ad its unique: + The pect eee Method This — mathedl q document Wher] ace wrectums an arya life abject 4 all elements which have all the given claws named) + NOTE - Prrvay Vike oby tet to not an array . €x— poem; etE lements By ClawName (test) 5 ILLS RRR ERATE EEE 99ooo eoonnene ‘ te he gooey ere Method > FH ww similar do che previous methool: P 2 » s Bs Tt also es decomsrt al Ph > Tt also returns = multiple lines.” > Me lst vetumed ow not an arvay, w Bw ~~ we an itera Alot — (wrt vAi Na n tere on ny "F ter loop « Theb= $0. returns, dbo. most Necercly selected elemert OF JavaScript object, 4 retums aha Second moast Yecently, Selected one and so on. “The very Selector Methodl Note: Use quaySelectorAly’ to ge dha multiple opecke Thie — mectheod! retum the dist element voithin, the clowment thet matcher thre Specified Selector, oY qr 4 selector, q no match ts grader then null PUo ooo bobees a Yetumed « a Cx qyvary Selecta y ehtader') Hw agp e very Selector Us header!) —> ZL i a claw wel querySeleetorU hesaler') > FH ty a te e Undate Getting — Content ; P ( ; he est tdnarbtth * ni Ke vouter HTML’ . . e HH . ctagt Content? SK immer Tent+ ae inner HTML ~ > TH wn qt or Get the HAE TM content esithin cha element >. Te con gee clement or al) ‘| ity descendents > TH an et on elements HTML content se coutey HTML The evtertt™ML attyibute of the element Don, tweerace qc the serialtzed HTML fragment diner ing the elemat tnelvaling its descendants « KO ctor Contant eoneee sf 7 yy The — texetContent property eet ov vetums “the 2 tert — covetent q th specified node, aro ail} \46 — descenclents « ddd’ TAL Deda ye Terteontent Sy . . >, Reotme 7 in twnevmeer OU thereat w/a Insole, a a then it oil) be ‘renoleys but in care textlontant tt vosil) be eek or the normal tect. Ex 4e> dbs Swe 4le> > mr ax A imevtget the /SWE! will be boll: SWE => Tr cue of tectlentent ebd will be prirtol as it t6 volthout balding the SWE + 2b> SWE nner Text “It ls similay to -tortbontert with some difference « SCV ov ooo vebevdces: Ex -— ep> | 4den ee LS? i

> TH me 4 tect content the selected fart will be printed: > Bot jy we we InnevText the selected Pore will be printeol except the dligptay hidden line. => c| the display : hidden Property ts urcol they it wil) not app 2a when we Use inner Tact « Visual Repreaentetion ees Se ee aa ‘ y capperd Chi lol) >To add Ht content We use append chill) D> TH puts the contort ost the toot Position In tha element. ae og “a Tact Noodle het nePara = document creakeElemartl'p') , Lit tectPara: > document 4 TTP PR Hells dss alps pie aoa = document create Element Cpt) 5 roy Pog, teretcontant = ‘Hello feels Short as contents append child Cony Poe) 5 From the akovt tag we tan tony add Stblige at tho lost position, only « Tw ad Hs si at He Specified positon we vse © balew metheol: ae tert Adacent TMU) ‘referrers. TE hon to be called“ vott, siagomuns YD tocatian | positon => _ where ‘ f W HUME text [content > what oe e! There are 4 positions init > — * beforebegin eae o wo Co *e alderbayin dives — é(olvs eo! * oeforeend —-—-——3 e ‘ 2 : * of feent “fe, nS . . es ae Dalelrg an Element [:Content er > vrenovethild O eo. > T+ is opposite q sappendl Child) eu: > We must knowdsparent clement. ‘4 >We must bow the child elemore whieh WR Ore ena 999999 « Par entsrremevethi le Elonnt),; Deleting ,a child etement without Eoae iy Bs -porverrt element. Here, Parent = child Eloment.parert Childeparart. remove chi a); ae Makivg oe in C&S vaing Ts ae sohyle => you con rrake ~sivgle’ See ony + CSS Text : ae Ee cotptrilbute] YOU con wake moliple cheng es FE clouaNtame | ot & ime as + claumList + Ex let content = go, > contert. contents eseTart = \colorsredl , fontesizes eon]; > Contents setAtnibute "stylet | “colov ved 5 Pog round — color: white ;"); SCVVVOOR_VELE OSE eererwrere ae ClavsNamt —> TH sels ov retum ian elements clone attribute. as EH retoms all tha claw name as ce uly avd to make chage youl have do convert eH into ath arrey: yee clays Ua i i > TL veturws tho css clacrames ¢| an elemont « > Tt xefoms,. in the, aryoy format *} “object type Features ada) — to add an clus remove) — 40 Temove ae clas togakt) — 4 clays ts preent dhen tt will delete ft Y not present than it wil) odd ts tontainst) — to check whether a clus clos ts preset or Not. TH veto Tue or ft GIFHHMHHSHPHHHSHHOHOHHHHOSR ODER SCC CoS

You might also like