Code: http://jsfiddle.net/MuHvy/
Javascript:
$(document).ready(function () {
$(".addTag").click(function () {
$('.questao').html($('.questao').html() + ' <span contentEditable="false" class="tagResp"> </span> ');
$('.questao').focus();
});
});
Span Css:
border:2px solid #dadada;
border-color:#9ecaed;
border-radius:7px;
display: inline-block;
height: 10px;
width: 50px;
padding:5px;
margin-top:3px;
box-shadow:0 0 10px #9ecaed;
white-space:nowrap;
This example should create a tag in the current line when the user clicks the button.
Problem: After the secound line, the Tag the jquery create for some reason jumps to a new line, instead of staying in the same line.
Example:
~WRONG~
randomtext randomtext <span>tag</span> <br>
randomtext <br>
<span>tag</span>
Should be:
randomtext randomtext <span>tag</span> <br>
randomtext <span>tag</span>
The other question is:
Its possible to focus the last line ? the jquery function .focus() goes to the start of the text, should be the end.
Thanks! I hope someone can help me.