1

Im using x-editable in a table.

When i click into a cell i can select from two options to put into it : Present and Absent.

Is it possible to have a class added to the cell if it has absent in it.

This is the JS for the X-ediatble :

<script type="text/javascript">
jQuery(document).ready(function() {  
        $.fn.editable.defaults.mode = 'inline';
        $('.xedit').editable({
        value: "-",    
        source: [
              {value: "-", text: '-'},
              {value: "Absent", text: 'Absent'},
              {value: "Present", text: 'Present'}
           ]
    }); 
        $(document).on('click','.editable-submit',function(){
            var key = $(this).closest('.editable-container').prev().attr('key');
var x = $(this).closest('.editable-container').prev().attr('id');
var y = $('.input-sm').val();
var z = $(this).closest('.editable-container').prev().text(y);

            $.ajax({
                url: "module/ppm2.php?id="+x+"&data="+y+'&key='+key,
                type: 'GET',
                success: function(s){
                    if(s == 'status'){
                    $(z).html(y);}
                    if(s == 'error') {
                    alert('Error Processing your Request!');}
                },
                error: function(e){
                    alert('Error Processing your Request!!');
                }
            });
        });
});
</script>
Drew
  • 19
  • 4
  • Look at http://stackoverflow.com/questions/1391278/contenteditable-change-events Do it with the input event – fab Aug 21 '15 at 11:04

0 Answers0