Jump to content

lilianda

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by lilianda

  1. hello,

     

    I'm trying to change my form button when it's clicked.

     

    Here is the HTML/PHP code for my button

     <button id='edit-btn' onclick='view_lead_make_editable_field(<?php echo json_encode($param);?>)'>Modifier</button>

    And here is my javascript function:

    function view_lead_make_editable_field(json_param){    /*.....some processing....*/var edit_btn = document.getElementById("edit-btn");    edit_btn.innerHTML="Enregistrer";    edit_btn.event.onclick=view_lead_save_field(json_param);}

    When I click the button, it's name is well modified to "Enregistrer" but the function associated to the onclick event is not changed. Looking at chrome developper console I can see : Cannot set property 'onclick' of undefined

     

    Why undefined since the button label has changed in the previous line ?

     

    Also, when clicking the button, the function view_lead_save_field(json_param) seems to be called which is even stranger...

     

    Thanks

×
×
  • Create New...