Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Safari onClick Alternative Using Jquery
Old 03-19-2010, 10:38 AM Safari onClick Alternative Using Jquery
Extreme Talker

Posts: 199
Trades: 0
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.

Code:
<script language="Javascript">
<!--

    $(document).ready(function() {
            $('.create_project').click(function(){
            alert('its working');
        });
    });

//-->
</script>
Code:
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()">
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-19-2010, 10:54 AM Re: Safari onClick Alternative Using Jquery
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
It works on my Safari. I don't know what you've been reading, but Safari has absolutely no problem with an onclick event.

However, if the HTML code you used exactly matches your second example:
Code:
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()">
I don't see why it would work in ANY browser. That is not even an HTML tag. I changed it to this for my test:
HTML Code:
<a href="javascript:void(0);" class="create_project">test</a>
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 03-19-2010, 11:02 AM Re: Safari onClick Alternative Using Jquery
Extreme Talker

Posts: 199
Trades: 0
interesting. im gonna have to strip my code down a lot and see whats breaking it. as for the code, its all there in my code. the C&P was incomplete.
empiresolutions is offline
Reply With Quote
View Public Profile
 
Old 03-19-2010, 12:51 PM Re: Safari onClick Alternative Using Jquery
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Here's the exact complete HTML I used to test Safari:
HTML Code:
<html>
<head><title>test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<a href="javascript:void(0);" class="create_project">test</a>
<script language="Javascript">
<!--

    $(document).ready(function() {
            $('.create_project').click(function(){
            alert('its working');
        });
    });

//-->
</script>
</body>
</html>
You should note that putting the <!-- and //--> tags inside your SCRIPT tags doesn't matter any more. It's an artifact from the days that some browsers did not understand JavaScript and would display it as text. Those days have long past.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Safari onClick Alternative Using Jquery
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47593 seconds with 12 queries