在console.log中显示值

时间:2016-04-20 03:55:11

标签: javascript jquery

如何制作它以便我可以在console.log()中显示inputName的价值。我目前一无所获 - 我错过了什么?

代码:

$(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 = '';  
        }
    }
}); 

});

1 个答案:

答案 0 :(得分:1)

删除引号:console.log(inputName);