Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2013
    Posts
    145
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Jeditable - get ID?

    hi, I am using the JQuery plugin Jeditable http://www.appelsiini.net/projects/jeditable

    I think I need to pass through the PageID to update the text in the database but my PageID.value is coming out as PageID.value and not 2 or 3?!

    Code:
    $(document).ready(function() {
    				var PageID = getElementById("PageID");
    				     $('.edit').editable('http://localhost:8888/dhs/admin/savetext.php?PageID='+PageID.value+'', { 
    				         id   : 'maincontent',
    				         name : 'textarea',
    				         type      : 'textarea',
    				         cancel    : 'Cancel',
    				         submit    : 'OK',
    				         indicator : 'Saving...',
    				         tooltip   : 'Click to edit...'
    				     });
    				 });
    PHP Code:
    echo '<input type="text" id="PageID" value="'.$row1['PageID'].'" />'

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,725
    Thanks
    6
    Thanked 1,013 Times in 986 Posts
    There are two ways to do it. With the native JavaScript way it must read var PageID = document.getElementById("PageID"); and going the jQuery way it must look like:

    Code:
    var PageID = $("#PageID");
    $('.edit').editable('http://localhost:8888/dhs/admin/savetext.php?PageID='+PageID.val()
    or even better:

    Code:
    var PageIDVal = $("#PageID").val();
    $('.edit').editable('http://localhost:8888/dhs/admin/savetext.php?PageID='+PageIDVal

  • #3
    Regular Coder
    Join Date
    Apr 2013
    Posts
    145
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thanks!


  •  

    Posting Permissions

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