Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

click event doesnt work

Posted on 2013-05-17
5
Medium Priority
?
352 Views
Last Modified: 2013-05-22
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
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39176415
You should post your entire page because that code works as is
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39176421
0
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 39176435
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
 
LVL 9

Expert Comment

by:Sar1973
ID: 39176848
Try to assign another ID to the div: they are identical.
0
 

Author Closing Comment

by:jagguy
ID: 39186895
I found solution (last post)
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
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…

715 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