Who is akash k and what is akash02designer ?

Jquery tips

1. Get closet span value on typing or keypress ?

<script>
$(document).ready(function(){
 

$(document).on('keypress','.chat_textarea',function(e){
if (e.which !== 13) {
var roomid=$(this).nextAll('span').attr('id');
alert(roomid);
}
});



});
</script>



<div>
<textarea id="11" class="chat_textarea"></textarea>
<i id="22"></i>
<span id="30"></span>

</div>


<div>
<textarea id="12" class="chat_textarea"></textarea>
<i id="33"></i>
<span id="31"></span>

</div>

2. Get closest div id on dynamic div?

<div class='.main_div'>
<div>
<button class='button'></button>
</div>
</div>

$(document).on('click','.button', function(){

var id= $(this).closest('.main_div').attr('id');

});


3. Empty div or full, if empty append?

var status_id =101;

if ($("#"+status_id+"_comment_row").children().length > 0)
{


return false;

}
else
{

$("#"+status_id+"_comment_row ").append('<div>Comment</div>');


}