function f(){
$("#main").focus();
}
$(document).ready(function(e) {
$("#main").focus();
$("button").hide();
$("li").live("dblclick", function(){
var node = document.createElement("ul");
var node_li = document.createElement("li"); // Create a <li> node
var textnode = document.createTextNode(""); // Create a text node
node_li.appendChild(textnode);
node.appendChild(node_li);
// Append the text to <li>
//document.getElementById("main").appendChild(node);
$(this).append(node);
//alert($(this).parent().children().index(this));
})
$('li').live('keypress',function(e){
var p = e.which;
if(p==9){
var node = document.createElement("ul");
var node_li = document.createElement("li"); // Create a <li> node
var textnode = document.createTextNode(""); // Create a text node
node_li.appendChild(textnode);
node.appendChild(node_li);
// Append the text to <li>
//document.getElementById("main").appendChild(node);
$(this).append(node);
}
});
});
// $(".fb li").live
function li_new(){
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
</script>
<p>Press "Enter for next lile" Double click on line for Sub-line.</p>
<div class="currentlist" contenteditable="true" id="main" onBlur="f()" style="height:2000px;">
<li></li>
</div>
<input type="tel" style="position:fixed; margin-left:10000px"/>
<div id="c"></div>
I use above code for create bullet item. Double click on
Please give a solution of add list and sub-list with press Enter Key and Press Tab key like MS Word. If content editable option is not good for what I want please give a solution how can I create and edit Bullet and sub-bullet item and give them style.
NOTE: I don't want use other option like bold, italic ect. Only need Bullet and Sub-bullet option using Enter and Tab Key.