4. Moving Elements


#1


Just to confirm that I understand how the empty() and remove() methods work, after utilizing them, the original HTML elements will still be present in the .html file? Correct?

I've noticed that when we've used the after() and before() methods it appears that the original HTML elements were not changed for our classes version of the .html document.


Example:

Portion of original .html file

...
<body>
<h1>Header</h1>
<div id="idOne">
    <p>Some text</p>
</div>
</body>
...

-

.js file

$(document).ready(function() {
    $('#idOne').remove();
});

-

Is the original .html file unmodified in the file directory?

...
<body>
<h1>Header</h1>
<div id="idOne">
    <p>Some text</p>
</div>
</body>
...

Or, has the original .html file been permanently modified to look like this...?

...
<body>
<h1>Header</h1>
</body>
...


#2

Yes. The source document is never altered, only the DOM representation. Altering the source document would mean physically editing it on the server. JS and jQuery only operate in client memory (for the most part) and don't generally alter anything on the storage device..


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.