Results 1 to 4 of 4

Thread: How would I post this to the page?

  1. #1
    Join Date
    Aug 2014

    How would I post this to the page?

    Hello, I'm new to JavaScript and I was wondering how I'd post what I wrote in my TextBox onto the HTML page. I got it to print out into the console, but not to the page. I also plan on making it save. This is my current Script:

    var postBlog = document.getElementById("postBlog")
    postBlog.onclick = function(){
    console.log("Someone wants to post a blogpost")


  2. #2
    Join Date
    Aug 2014
    Here is the simplest possible thing you could do.
    Say you have an HTML element <div id="blog"> where you would like to post the content from TextBox.
    Just add the last line to your script:

    var postBlog = document.getElementById("postBlog");
    postBlog.onclick = function(){
    console.log("Someone wants to post a blogpost"); console.log(document.getElementById("Texto").value); document.getElementById("blog").textContent = document.getElementById("Texto").value;
    }; </script>
    There you have it.
    And as for saving it, you can't really do that permanently with only javascript. You could save it for the current user (and the current browser in use) using localstorage but that isn't really persistent.

  3. #3
    I completely agree with you "aloyzije" great information.

  4. #4
    Join Date
    Feb 2014
    I wasn't use any time Java i think this is tough language what you say friends?

Thread Information

Users Browsing this Thread

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

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