View Single Post
Old 10-01-2011, 05:14 AM   PM User | #4
rangana
Senior Coder

 
rangana's Avatar
 
Join Date: Feb 2008
Location: Cebu City, Philippines
Posts: 1,752
Thanks: 65
Thanked 372 Times in 365 Posts
rangana will become famous soon enoughrangana will become famous soon enough
This worked:
PHP Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<div class="info">This is a test</div>

I'm using jQuery to try and do some inline editing. So I use this code I made:
<script>
var original;
$(document).ready(function() {
    $(".info").click(function() {
    original = $(this).html();

    var textarea = '<div><textarea name="comments" cols="60" rows="3">' + $(this).html() + '</textarea>';
    var button = '<input type="button" value="Save" class="saveButton" /> OR <input type="button" value="Cancel" class="cancelButton" /></div>';

    $(this).after(textarea+button).remove();
    });
    
    $('.cancelButton').live('click',function() {
    $(this).parent().parent().html('<div class="info">' + original + '</div>');
    $(this).parent().remove();
    });
});
</script> 
__________________
Learn how to javascript at 02geek

The more you learn, the more you'll realize there's much more to learn
Ray.ph
rangana is offline   Reply With Quote