-5

How can I make it so that I can show in console.log() what the value of inputName is. I am currently getting nothing - what have I missed?

Code:

$(function(){


$.fn.editable.defaults.mode = 'inline';

  var inputName = $(this).data("title");

$('.updateField').editable({
    type: 'text',
    url: '/post',    
    pk: 1,    
    placement: 'top',
    title: 'Enter public name',
     toggle:'manual'    
});

$('.edit').click(function(e){    
       e.stopPropagation();
       console.log("inputName");
       $('.updateField').editable('toggle');
       $('.edit').hide();
});
    $(document).on('click', '.editable-cancel, .editable-submit', function(){
        $('.edit').show();
    })        
//ajax emulation. Type "err" to see error message
$.mockjax({
    url: '/post',
    responseTime: 100,
    response: function(settings) {
        if(settings.data.value == 'err') {
           this.status = 500;  
           this.responseText = 'Validation error!'; 
        } else {
           this.responseText = '';  
        }
    }
}); 

});
Jess McKenzie
  • 8,345
  • 27
  • 100
  • 170

1 Answers1

1

Remove the quotes: console.log(inputName);

Andy Hoffman
  • 18,436
  • 4
  • 42
  • 61