Search code examples
jqueryjeditable

Where does this text come from ? with editable


I use the jeditable jquery plugin. My table is like that :

enter image description here

I have this problem : when I click on a jeditable field, this text appears :

enter image description here

My js code is :

 $('.edit').each(function(){
     $(this).editable($('#url_for_ajax').val()+'/update_role_ajax', {

         indicator  : '<img src="'+$('#url_for_ajax').val()+'/img/waiting.gif'+'">',
         tooltip    : 'Clic pour modifier la valeur',
         style      : 'inherit',
         height     : '20px',
         onchange   : 'submit',
         cssclass   : 'input',
         id         : 'id_role',
         name       : 'new_value',
         submitdata : {  
                 'id_role'   : $(this).data('id_role'),
                 'nom_champ' : $(this).data('nom_champ'),
                 '_token'    : $('meta[name="_token"]').attr( 'content' )
                    },
         callback   : function(value, settings) {

                // 

            },
         onerror    : function(settings,original,xhr){
                alert("It wasn't possible to edit. Try again");
                console.log("XHR Status: " + xhr.status)} 
        });
    });

Any idea where does this text come from ?

Dominique


Solution

  • That happens because it will take as editable whatever is inside the element that has edit class.

    Most likely you have a span element inside the element with the edit class, that's why it showing that way. The editable element shouldn't contain other elements inside, just plain text.

    Try to add the edit class to the span instead and it should work.