SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: JavaScript not working in IE

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    canada
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript not working in IE

    Hello,

    The following Java script works in chrome, firefox but not in IE10. ANy thoughts on this?

    HTML Code:
    <script> 
    	$(document).ready(function() { 
    	       $('#btn_click').on('click', function() { 
    	      var url = 'test.php';
    	     $('#div1-wrapper').load(url + ' #div1'); 
    	   }); 
    	}); 
    </script>

  2. #2
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,370
    Mentioned
    38 Post(s)
    Tagged
    1 Thread(s)
    Hi there,

    There is nothing wrong with your script.
    It works for me on IE7 - IE10 and all of the other major browsers.

    This is the code I used to test (note if you include your JS at the bottom of the page you can do away with the call to $(document).ready())

    index.html

    HTML Code:
    <!DOCTYPE HTML>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>jQuery load</title>
      </head>
      <body>
        <button id="btn_click">Button</button>
        <div id="div1-wrapper">This will be replaced.</div>
    
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script>
          $('#btn_click').on('click', function() {
            var url = 'test.php';
            $('#div1-wrapper').load(url + ' #div1');
          });
        </script>
      </body>
    </html>
    test.php

    PHP Code:
    <div id="div1">Some random content!</div
    Could you maybe post a link to a page where we can see this not working in IE10.
    Start a blog, they said. People will read it, they said.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    canada
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have a local web server installed.
    strange problem...works in firefox but not in IE 8 or 10




    Quote Originally Posted by Pullo View Post
    Hi there,

    There is nothing wrong with your script.
    It works for me on IE7 - IE10 and all of the other major browsers.

    This is the code I used to test (note if you include your JS at the bottom of the page you can do away with the call to $(document).ready())

    index.html

    HTML Code:
    <!DOCTYPE HTML>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>jQuery load</title>
      </head>
      <body>
        <button id="btn_click">Button</button>
        <div id="div1-wrapper">This will be replaced.</div>
    
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script>
          $('#btn_click').on('click', function() {
            var url = 'test.php';
            $('#div1-wrapper').load(url + ' #div1');
          });
        </script>
      </body>
    </html>
    test.php

    PHP Code:
    <div id="div1">Some random content!</div
    Could you maybe post a link to a page where we can see this not working in IE10.

  4. #4
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,370
    Mentioned
    38 Post(s)
    Tagged
    1 Thread(s)
    Hi there,

    Quote Originally Posted by robin01 View Post
    i have a local web server installed.
    strange problem...works in firefox but not in IE 8 or 10
    Yeah, that is strange, especially as I am testing it on a local web server, too and the code I posted works fine for me in all IEs.

    Could you post the code from your two files and I'll have a look at that.
    Start a blog, they said. People will read it, they said.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •