Int he below code a textarea is added 6 times and initially the textarea conatins the text Enter Text. My question is, if the user enters data in first and third textareas. How to give alert to the user saying that the "textareas are empty" this is a general message but focus on the 2nd textarea and when the user enters data in 2nd the next textarea should be focused.
<script>
function ad_R(count)
{
//Adding and populating table row
var row = '<tr>';
row += '<td>';
row += '<textarea rows = "8" cols = "18" border ="0" class="input" style="border:none;overflow:visible;width:100%;" id="details'+count+'" nfocus="if (this.value == \'Enter text\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'Enter text\';" name ="detail'+count+'" class="row_details'+r_count+'">Enter text</textarea></td></tr>';
}
$(document).ready(function() {
cnt += '<table cellspacing="0" cellpadding="0" border="1" width="100%" id="_table">';
cnt += '<tr>';
cnt += '<th width="30%">Category</th>';
cnt += '</tr>';
for(var i=0;i<6;i++)
{
cnt += add_R(6);
}
cnt += '</table>';
});