Solved

HTML TD Top Right X Click?

Posted on 2014-10-29
8
146 Views
Last Modified: 2014-11-04
It seems the background image is the best way to place a clickable X in the top-right corner of a table td. I cannot have the entire td clickable.
Q. Would use a very small image and position to the right side?

Also need the click event fire a function which will remove the TD and it's one label.
0
Comment
Question by:WorknHardr
  • 4
  • 4
8 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
We might be able to help if we could see your code.  It's just guessing otherwise.  A TD is part of a table.  Removing one TD will have an effect on the rest of the table.
0
 

Author Comment

by:WorknHardr
Comment Utility
Doing this from my iPhone. It's one master table with two side-by-side tables, each having several row items. The red-x click on each td containing the title label will remove its table. This leaves the master table with one less nested table.

<table id="master">
<tr>
<td>
<table>
    <tr><td><label>title1</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
 </table>
</td>
<td>
<table>
    <tr><td><label>title2</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
</table>
</td>
</tr>
</table>
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
Here is a very simple example with text instead of an image.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- HideTable.html -->
<title>Hide the Table</title>
<script type="text/javascript">
<!--
function hide1() {
	document.getElementById('table1').style.visibility = 'hidden';
	document.getElementById('table1').style.display = 'none';
	}

// -->
</script>
</head>
<body>
<h1>Hide the Table</h1>
<table id="master" width="240px" border="1">
<tr valign="top">
<td width="120px">
<div align="right" onclick="hide1()"><b>Click here</b></div>
<table id="table1">
    <tr><td><label>title1</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
 </table>
</td>
<td>
<table id="table2">
    <tr><td><label>title2</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
</table>
</td>
</tr>
</table>

</body>
</html>

Open in new window

0
 

Author Comment

by:WorknHardr
Comment Utility
Nice, I need to use an image...
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Just put the image in place of "<b>Click here</b>".
0
 

Author Comment

by:WorknHardr
Comment Utility
Got it, thx
0
 

Author Closing Comment

by:WorknHardr
Comment Utility
Got it, thx
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
You're welcome.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now