Hobbyist_PHPer Posted September 8, 2012 Share Posted September 8, 2012 I have been having problems with making a DIV clickable... To rule out any other possibilities, I created a test.php page and it still won't fire when I click on the DIV... The code follows... Can someone please tell me what I'm doing wrong? <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $("#TestDiv").click(function() { alert("Handler for .click() called."); }); </script> <title>Test</title> </head> <body> <div id="TestDiv" style="width: 100px; border: 1px #000 solid;"> Click Here </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/268165-need-help-making-a-div-clickable/ Share on other sites More sharing options...
Hobbyist_PHPer Posted September 8, 2012 Author Share Posted September 8, 2012 I got it to work... I had to wrap the script that I had with this... $(document).ready(function(){} Link to comment https://forums.phpfreaks.com/topic/268165-need-help-making-a-div-clickable/#findComment-1376355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.