A me continua a non funzionare ti posto il codice completo:
Codice HTML:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".b").click(function() {
var x = getSelectedInputText($(".txt"));
alert(x);
});
});
function getSelectedInputText(element){
return element.value.substring(element.selectionStart, element.selectionEnd);
}
</script>
</head>
<body>
<nav>
<ul>
<li><input type="button" class="button b" value="b" /></li>
<li><input type="button" class="button i" value="i" /></li>
<li><input type="button" class="button u" value="u" /></li>
</ul>
</nav>
<article>
<textarea class="txt"></textarea>
</article>
</body>
</html>