westman Posted May 20, 2012 Share Posted May 20, 2012 (edited) i have an error in one line of javascript code... $("#whatisit").html('<a href="#" title="chat" onclick="return false" onmousedown="javascript:togglechat('"+chat+"');"><img src="chat.png" alt="chat" width="44" height="40" /></a>').show(); the problem is '"+chat+"'what do i put there? Edited May 20, 2012 by westman Link to comment Share on other sites More sharing options...
dsonesuk Posted May 20, 2012 Share Posted May 20, 2012 You can't use double quotes with an event call that uses double quotes as opening and closing, try $("#whatisit").html('<a href="#" title="chat" onclick="return false" onmousedown="javascript:togglechat('+chat+');"><img src="chat.png" alt="chat" width="44" height="40" /></a>').show(); Link to comment Share on other sites More sharing options...
westman Posted May 20, 2012 Author Share Posted May 20, 2012 togglechat('+chat+') = i can not see the imagetogglechat(chat) = i can see the image but togglechat will not runstill not working Link to comment Share on other sites More sharing options...
eTianbun Posted May 20, 2012 Share Posted May 20, 2012 Then lets see your togglechat() function. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 20, 2012 Share Posted May 20, 2012 If quotes are required try $("#whatisit").html('<a href="#" title="chat" onclick="return false" onmousedown="javascript:togglechat(\''+chat+'\');"><img src="chat.png" alt="chat" width="44" height="40" /></a>').show(); Link to comment Share on other sites More sharing options...
westman Posted May 20, 2012 Author Share Posted May 20, 2012 togglechat('+chat+') = i can not see the imagetogglechat(chat) = i can see the image but togglechat will not runtogglechat(\''+chat+'\') = i can not see the imagetogglechat() = i can see the image but togglechat will not run still not working Link to comment Share on other sites More sharing options...
eTianbun Posted May 20, 2012 Share Posted May 20, 2012 Then lets see your togglechat() function. Link to comment Share on other sites More sharing options...
westman Posted May 20, 2012 Author Share Posted May 20, 2012 got it working togglechat(\'chat\') happy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now