12-13-2012 12:54 AM
I'm trying to give focus to a textarea inside a div that is on top of another div. This is how it goes div#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.
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);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.
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="Submit"></td>
strDialog += '</tr>';
strDialog += '</table>';
strDialog += '</div>';
$('#container').after(strDialog);
setTimeout(function () {blackberry.focus.setFocus('textRemark'); }, 300);
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.
12-16-2012 01:04 AM
Have you tried something like...
function getfocus()
{
document.getElementById('textRemark').focus()
}
12-16-2012 06:13 AM
Thank you. It's working.
But how do I use blackberry.focus.setFocus?
12-16-2012 11:13 AM
12-16-2012 10:09 PM
Thanks for the link but is there any examples to show how to use them?
12-17-2012 09:42 PM
Hello iruka,
Hopefully this will help...