Hello, I have the following code.
function abreConteudo(element) {
alert($(element).attr('class'));
alert($(element > "div.descricaoobs").text());
}
$(document).ready(function () {
$("div.botao_melhor_leitura").click(function (e) {
$(this).find(".descricaoobs").attr('style', 'display:block;');
var mousex;
var estado = $(this).find(".descricaoobs").attr('class');
/*var tipVisX = $(window).width();*/
$(this).find(".descricaoobs").css({
right: mousex
});
})
})
.descricaoobs{
overflow-y:hidden;
border: #999999 solid 1px;
background-color:#F8F8FF;
position:center;
padding:1px 3px;
position: absolute;
display: none;
text-align: left;
font-size:12px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Globo.com Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
</head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><body><tablestyle="width:100%" border="1">
<tr>
<td>id</td>
<td>obs</td>
<td>Teste1</td>
<td>Teste2</td>
<td>Teste3</td>
<td>Teste4</td>
<td>Teste5</td>
</tr>
<tr>
<td>Eve</td>
<td>
<div class='botao_melhor_leitura'>
<button type="button">Clique aqui</button>
<div class='descricaoobs'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat qua</div>
</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat quam. Aenean suscipit lectus massa, sit</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis euismod dolor, eu consequat quam. Aenean suscipit lectus massa, sit</td>
</tr>
</table>
</body>
</html>
This is to open a div with a text when I click on the button. So far, the problem is that I need a button to exit this div. It may be a close button or when clicking outside the div close it.
Someone can help me.