Jess McKenzie Jess McKenzie - 7 months ago 23
Javascript Question

Showing Value in console.log

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

});

Answer

Remove the quotes: console.log(inputName);

Comments