How do I access only one item?

  • 0
    I only want to edit one block but the functions apply to the whole document and
    var doc = $('.conttext').get(0);
    $("body" ).on('click', ".italic", function(e) {
    	doc.execCommand('italic', false);

    <div class="conttext" contenteditable >Text1</div>
    <div class="conttext2" contenteditable >Text2</div>
    <a href="#" class="italic">italic</a>

    doesn't work
    How to fix it ?
    JavaScript Hadley Henry, Jul 29, 2020

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!