Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

click event doesnt work

Hi,

I cant click on my link that is in a div(2nd link). I need this to link to be in a div to swap an image.
How do I enable the click event like the 1st link does?

<a href="home.html"><img  src="images/ic1.png" alt=""/></a>

 
<div id="imgswap"> <a href="home.html"><img id="imgswap" src="images/ic1.png" alt=""/></a></div>  //click event doesnt work?

Open in new window

0
jagguy
Asked:
jagguy
1 Solution
 
Scott Fell, EE MVEDeveloperCommented:
You should post your entire page because that code works as is
0
 
leakim971PluritechnicianCommented:
0
 
jagguyAuthor Commented:
OK I found better code to make it work.
I do put it in a list and just swap images over hover.


ul.nav
{
    list-style-type: none;
    padding: 0;
    margin: 0;
    float: left;
    
}

ul.nav a
{
    border: 0px solid #cccccc;
    display: block;
    height: 100px;
    padding-top: 72px;
    width: 100px;
    
}

.nav li#welcome a {
	 background-image:url(images/ic1.png); 
  background-repeat: no-repeat; 
	 
	 }
.nav li#welcome a:hover {
	 background-image:url(images/ic1b.png); 
  background-repeat: no-repeat; 
   }

.nav li#welcome2 a {
	 background-image:url(images/ic1.png); 
  background-repeat: no-repeat; 
	 
	 }
.nav li#welcome2 a:hover {
	 background-image:url(images/ic1b.png); 
  background-repeat: no-repeat; 
   }
 
 
   
#head{
	
}
	
</style>
</head>

<body>


<div id="head">
  <ul class="nav">
    <li id="welcome"><a href="home.html"></a></a></li>
    <li id="welcome2"><a href="home.html"></a></a></li>
  </ul>
</div>

Open in new window

0
 
Sar1973Commented:
Try to assign another ID to the div: they are identical.
0
 
jagguyAuthor Commented:
I found solution (last post)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now