Giving Focus to Textarea inside Top Layer Div

xyleli8gas

New Member
I'm trying to give focus to a textarea inside a div that is on top of another div. This is how it goesdiv#container is the bottom div whereby it will list out rows of records from database and there will be a link for users to click on ADD.\[code\]strBtmDiv += '<div id="container">';strBtmDiv += '<table id="tablePending">';strBtmDiv += '<tr>';strBtmDiv += '<td>Detail One</td><td>Detail Two</td><td>Detail Three</td><td onclick="showDialog()">ADD</td>';strBtmDiv += '</tr>';strBtmDiv += '</table>';$('#mainBody').html(strBtmDiv);\[/code\]When user clicks on ADD onclick will fire another function showDialog() that displays a textarea and submit button for user to submit the addedd text.\[code\]strDialog += '<div id="overlay">';strDialog += '<table id="tblDialog">';strDialog += '<tr>';strDialog += '<td><textarea id="textRemark" cols="10" rows="5"></textarea></td><td><input type="submit" value="http://stackoverflow.com/questions/13852021/Submit"></td>strDialog += '</tr>';strDialog += '</table>';strDialog += '</div>';$('#container').after(strDialog);setTimeout(function () {blackberry.focus.setFocus('textRemark'); }, 300);\[/code\]showDialog()/div#overlay will be added after the div#container and then using css z-index so div#overlay will appear on top of div#container. I have tried to set focus to the textarea using setTimeout(function () {blackberry.focus.setFocus('textRemark'); }, 300) but it is not working. Can anyone please help?Thank you.
 
Back
Top