shadiadiph Posted October 23, 2010 Share Posted October 23, 2010 Is there an easy way to add a caret (cursor) to a div so you can type? without using textarea as an input Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/ Share on other sites More sharing options...
ignace Posted October 23, 2010 Share Posted October 23, 2010 contenteditable="true" Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/#findComment-1125558 Share on other sites More sharing options...
shadiadiph Posted October 23, 2010 Author Share Posted October 23, 2010 thanks for the reply but i am a bit dumb when it comes to javascript <div id="tesxareatest" name="textareatest" contenteditable="true"></div> doesn't work Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/#findComment-1125560 Share on other sites More sharing options...
ignace Posted October 23, 2010 Share Posted October 23, 2010 Take a look at http://html5demos.com/contenteditable. At the very least they'll have the necessary JS to edit your post. I personally tried on IE7 through 9 and FF. Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/#findComment-1125575 Share on other sites More sharing options...
shadiadiph Posted October 24, 2010 Author Share Posted October 24, 2010 thanks seems to work but not sure if it is what i wanted as i am trying to format the text bold underlined etc problem is when I add a <b> tag to the innerHTML it seems to automatically close it so the font type doesn't change?? Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/#findComment-1125823 Share on other sites More sharing options...
ignace Posted October 24, 2010 Share Posted October 24, 2010 Euhm it seems like you are looking for a WYSIWYG editor, try: http://ckeditor.com/. You can use the onclick event of the div to change the div into an editor. CKEditor works on both textarea as normal html elements. Quote Link to comment https://forums.phpfreaks.com/topic/216640-add-a-cursor-to-a-div-so-you-can-type/#findComment-1125831 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.