www.webdeveloper.com
Results 1 to 5 of 5

Thread: jQuery won't change inner HTML

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    6

    jQuery won't change inner HTML

    In my head tag I have <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.6.2.min.js"> </script> and later in another

    script tag I have:

    $(document).ready(function(){
    $("p#test").html("AAAA");
    }

    In the body of my document I have:

    <p id="test">a</p>

    However, when I load the page it displays "a" instead of "AAAA".

  2. #2
    Join Date
    Jul 2012
    Posts
    6
    I just realized that I needed to add a parenthesis and semicolon at the end to make it:

    $(document).ready(function(){
    $("p#test").html("AAAA");
    });

    However, it is still not working.

  3. #3
    Join Date
    Jul 2012
    Posts
    6
    I found the problem. I moved it ahead of some other code and then it worked. Apparently, the other code wasn't working which caused the page to freeze. However, I now have a new problem. I have:

    var page = new XMLHttpRequest();
    page.open("GET", "http://....");

    Putting $("p#test").html("AAAA"); ahead of page.open is what makes it work, so page.open seems to be causing the page to freeze. How do I get page.open to work properly?

  4. #4
    Join Date
    Jul 2012
    Posts
    6
    I have been trying this in Internet explorer. I just tried this in Google Chrome and it got past page.open(), but instead froze at XMLdata.getElementsByTagName("BODY");

  5. #5
    Join Date
    Jul 2012
    Posts
    6
    I changed it so I now use page.responseText instead of using XML but page.responseText returns an empty string instead of the page contents.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles