Total members 11893 |It is currently Tue Nov 05, 2024 11:46 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Remove HTML element or Delete its content
html code
<html>
<head>
<title>Remove & Empty</title>

<!--
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
 Note you can download the JQuery package instead of using Google version. --> 
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
 // Remove HTML element 
  $("button#B1").click(function(){
    $("#part1").remove();
  });
  // Remove HTML content
    $("button#B2").click(function(){
    $("#part2").empty();
  });
  
   
 
  
});
</script>
</head>

<body>
<button id="B1">Remove</button>
<button id="B2">Empty</button>
 
<div id="part1" style="background:#0222F1;color:#F0F0F0;height:58px;width:300px;">
This html element will be removed after u click on Remove.</div>
<div id="part2"  style="background:#F22201;color:#F0F0F0;height:58px;width:300px;">
The content of this element will be remove once u click on Empty </div>
 
 
</body>
</html>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Remove HTML element or Delete its content
 Change and get html content of element     -  
 How to delete/remove images from excel 2007 using POI.     -  
 Add and Remove CSS classes to html tag dynamically     -  
 opacity of HTML element- transparent     -  
 Get the position of HTML element using JQuery     -  
 How to make html element hidden using CSS     -  
 Get Width and Height -Inner and Outer for HTML element     -  
 removing focus border from a HTML element     -  
 checking if a HTML element is visible or hidden under JQuery     -  
 Show hint when focus on html element using JQuery     -  



Topic Tags

JQuery Content






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com