• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

jQuery question

 
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM). I kind of do not understand what DOM is. I read in Wikipedia that DOM is a way of representing xml and html pages. Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM? Can anyone please explain me in simple words?

Thanks.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arjun Reddy wrote:I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM).

jQuery makes it easy to manipulate the DOM, but only if that's your intent. There're many calls that do not touch the DOM.

Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM?

Yes. The DOM is the in-memory representation of the elements in the document.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Arjun Reddy wrote:I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM).

jQuery makes it easy to manipulate the DOM, but only if that's your intent. There're many calls that do not touch the DOM.

Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM?

Yes. The DOM is the in-memory representation of the elements in the document.



Thanks for answering all the questions Bibeault I have 2 more questions on this concept

1). I believe DOM and DOM parser are not the same. Correct?

2). DOM is an in Memory representation of HTML or XML documents right? What's the memory here? database? Sorry, I kind of always get confused with the in-memory thing.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Correct, mostly because I'm not sure what a "DOM parser" is. An HTML parser, or XML parser, will create a DOM from an HTML or XML document.

2) Memory is where the computer stores data that it is actively working with. See.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, So this is what I have understood about jQuery now. jQuery is JavaScript which does not work on HTML elements but it works on Document object model's object representation of those elements. Right? if that's true, why not work on the html elements and work on the DOM object representation of those html elements?
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.



Thanks Bibeault.
 
My, my, aren't you a big fella. Here, have a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic