An element is removed from the html file with the following code,

$("#sample").remove();

When view the source code, the removed element still appear in the source code. Whether it is possible to remove the element from the source code?

If you mean it's still visible when you do "View Source" then yes. That only shows the initial downloaded page. If you inspect the page with the developer tool, you see what's in the DOM. Your element should not be shown there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.