Skip to content Skip to sidebar Skip to footer

How To Make A Div With A Blinking Cursor And Editable Text Without Using ?

I need to make a div layer so that when you click on it you will have your cursor there blinking and you can insert/delete text just like does, except tha

Solution 1:

DIV element has (other elements as well) contentEditable property that you can set in Javascript to true.

getElementById('YourDiv').contentEditable = true;

Solution 2:

You can make the div editable by setting its contentEditable attribute / property to true. However, for anything that is slightly more powerful or flexible then very basic editing, you might want to look at existing solutions such as:


Solution 3:

Jquery can be used like this:

$.('#yourDiv').click(function() {
    $(this).attr('contenteditable', 'true');
});

Solution 4:

I suggest you to use a textarea, and if that's not enough, use a WYSIWYG editor like tinyMCE or FCKeditor.


Solution 5:

as I understand your problem, you can resove it by adding textarea into your div. It is very simply to make this textarea autosize to occupy whole div area and looks like this div.

As for contentEditable, I have seen some browsers, supported this feature for div-element and does not. Anyway, you can use iframe in your div. It's document-element can have contentEditable.


Post a Comment for "How To Make A Div With A Blinking Cursor And Editable Text Without Using ?"