jamjam Posted November 27, 2010 Share Posted November 27, 2010 Hi This is very silly question, but can someone please tell what is wrong. I have a small piece of javascript code Here it is. google.load("jquery", "1.3.1"); jQuery.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }; $(document).ready(function() { $('#tellfriend').hide(); $('li a.email, #tellfriend a.close').click(function() { $("#tellfriend").fadeToggle('slow'); }); }); Once a email icon button is clicked this code fades in a email form. The associated html looks like this <li><a class="email" href="#tellafreiend" alt="Email" id="emails">Email</a></li> This all works. But I need to change the associated html to something like this <li><a href="#tellafreiend" alt="Email"><img src="/files/email.png" alt="Email"/></a></li> However once I do this the fade in effect no longer works and I do not see the email form. I know the problem is properly a result of incorrect class or id. But I cannot fix it. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/219998-calling-a-javascript-function/ Share on other sites More sharing options...
JasonLewis Posted November 27, 2010 Share Posted November 27, 2010 This isn't PHP related my friend. And you haven't added the class to the second piece of code there. You need class="email" so that the jQuery will work. Quote Link to comment https://forums.phpfreaks.com/topic/219998-calling-a-javascript-function/#findComment-1140433 Share on other sites More sharing options...
jamjam Posted November 28, 2010 Author Share Posted November 28, 2010 I worked it out It seems there was conflicting class as when I added "email" nothing was showing up. Chooosing a different class solved the problem. Quote Link to comment https://forums.phpfreaks.com/topic/219998-calling-a-javascript-function/#findComment-1140539 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.