Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 5 of 5

Thread: Need help with building simple editor

  1. #1
    6
    posts
    The only one planned for.

    Need help with building simple editor

    I have just the basic skill of PHP and Javascript(Still not vary good at), and MySQL. I am trying to learn a bit about editing the "innerHTML" of a span tag. I saw a lot about it in the Ajax edit in place but that isn't what I am looking for. I don't know how to call the content to a text box for editing though and even then I still don't know what to do after that so I REALLY need some direction here of I might just ruin something.

    Thank-you.

  2. #2
    Okay, so if I have read this right you want to....

    Get the content of a span in the HTML and insert the content of that span into a text box as a value? Would this happen on page load or does something trigger it?

  3. #3
    This is for a quick edit phpbb mod I'm working on:

    Code:
    function openEditor(){
    	if(document.getElementById('inlineEditBox') != null){
    		alert('You must first finish editing your other post.');
    	}
    	else{
    		f = document.getElementById('postDiv').innerHTML;
    		f = "<textarea id='inlineEditBox' class='inputbox' rows='8'>" + f + 
    				"</textarea><br /><input type='button' value='Submit' onClick='commit("+pid+")' />";
    		document.getElementById('post_' + id).innerHTML = f;
    	}
    }
    Basically, you use innerHTML to get the contents, then you make innerHTML equal to the old html, wraped in textarea tags.

  4. #4
    6
    posts
    The only one planned for.

    Sorry for taking so long.

    Quote Originally Posted by evildrummer View Post
    Okay, so if I have read this right you want to....

    Get the content of a span in the HTML and insert the content of that span into a text box as a value? Would this happen on page load or does something trigger it?
    There will be a small button to trigger it in the right hand corner of the element. I am going to make it only show up if the user has the ability to edit the page, otherwise it won't even exist on the viewing side.

  5. #5
    6
    posts
    The only one planned for.
    Quote Originally Posted by blazes View Post
    This is for a quick edit phpbb mod I'm working on:

    Code:
    function openEditor(){
        if(document.getElementById('inlineEditBox') != null){
            alert('You must first finish editing your other post.');
        }
        else{
            f = document.getElementById('postDiv').innerHTML;
            f = "<textarea id='inlineEditBox' class='inputbox' rows='8'>" + f + 
                    "</textarea><br /><input type='button' value='Submit' onClick='commit("+pid+")' />";
            document.getElementById('post_' + id).innerHTML = f;
        }
    }
    Basically, you use innerHTML to get the contents, then you make innerHTML equal to the old html, wraped in textarea tags.
    That is basically what I want but I'll need to make a version of my own. This my be a while.

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012