Yeats Yeats - 1 year ago 73
Javascript Question

Why is innerHTML returning 'undefined'?

I'm trying to catch the "value" inside this div, which is editable:

<div class="editable-div" contentEditable="true">Hey</div>

I figured I could do this simply via JavaScript:

var changedText = $('.editable-div').innerHtml

However, this variable will always return "undefined", which confuses me.

Can someone enlighten me on how to reach this "value"?

Answer Source

It is jQuery - you have to use: