cesarcesar Posted March 19, 2010 Share Posted March 19, 2010 After much research i understand that Safari isn't able to call the onClick Event like the other browsers do. So how do i get Safari to act like the other browsers is my question? I have see no real alternative. Can any of you help? My current code is below. It works in all browsers except Safari (haven't checked Chrome, but it should be same as Safari what i read). Thanks much. <script language="Javascript"> <!-- $(document).ready(function() { $('.create_project').click(function(){ alert('its working'); }); }); //--> </script> a href="javascript:void(0);" class="create_project"><img src="b.create.off.gif" width="99" height="45" border="0" id="Image51" onMouseOver="MM_swapImage('Image51','','b.create.on.gif',1)" onMouseOut="MM_swapImgRestore()"> Quote Link to comment Share on other sites More sharing options...
JustLikeIcarus Posted March 25, 2010 Share Posted March 25, 2010 Try it this way and see if it works for you. The onMouseOver/Out events are properties of the a element not the img element so I moved those. Also your link didnt have a closing </a>. You shouldn't have to worry about how Safari handles click events since the jQuery core code is set to compensate for differences based on the browser being used. Also I would remove the mouse events from the link and just use css to swap the image on hover. It is also possible that they are causing an issue in regards to safari not triggering the jQuery click function correctly. <script language="Javascript"> <!-- $(document).ready(function() { $('.create_project').click(function(){ alert('its working'); return false; }); }); //--> </script> <a href="#" class="create_project" onMouseOver="MM_swapImage('Image51','','b.create.on.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="b.create.off.gif" width="99" height="45" border="0" id="Image51" ></a> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.