Text of first div equals to text of second div equals to html of third div on keyup

I am having three div with content editable option and I want that text of 1st div = text of 2nd div = html of 3rd div. I am able to do it in two lines of code but code is not working when I am trying to convert it into single line. Please take a look at my code.

// Working Code
$("#img1").keyup(function() {

// Not Working
$("#img1").keyup(function() {

>Solution :

This works, friend. But it’s ugly.

$("#img1").keyup(function() {
body {display:flex}
div {flex:1 1; height:90vh;border:solid 1px #693}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div id="img1" contenteditable></div>
<div id="dimg1"></div>
<div id="oimg1"></div>

Leave a Reply