0

I have an HTML file with a simple jQuery highlight effect in it.

This works fine. But when i change the extension of the file from .html to .php and I upload it to my server, it just doesn't work.

by it doesn't work i mean it doesn't highlight the Div.

Here's the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
div {
width: 100px;
height: 100px;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="hflip.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="counter"></div>
<form>
<input name="ajaxlink" type="button" id="ajaxlink" class="ajaxlink" />
</form>
<script>
$( '#ajaxlink' ).click(function() {
$( "#counter" ).effect( "highlight", "slow" );
});
</script>
</body>
</html>

what am I doing wrong? why it works fine in an HTML file and it doesn't in a .PHP file?

7
  • What exactly happens when you change the extension to PHP and load it? Are you sure your server supports PHP? Commented Oct 3, 2013 at 12:51
  • 1
    you sure this is your code, as it is giving an Typeerror $(...).effect is not a function ? Commented Oct 3, 2013 at 12:51
  • @JonathonHenderson, nothing happens. when i click the button it doesn't highlight the Div as it should. and yes, my server supports PHP. Commented Oct 3, 2013 at 12:52
  • 1
    you're calling jquery 1.9.1 twice too Commented Oct 3, 2013 at 12:52
  • 1
    Why are you trying to load jQuery twice? Are there any errors on the JavaScript console? Commented Oct 3, 2013 at 12:52

3 Answers 3

0

Remove this script and run your code.. :)

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

0

just replace :

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

with

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

and remove the last script inclusion

Working fine with PHP file extension too..

Please check

Comments

0

There is no <body> (open tag). and twice inclusion of jquery

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.