开发者

Calling onclick rich tab to place cursor in a textfield

My requirement is to place the cursor on a field whenever a rich tab is navigated to. I tried onclick and onlabelclick on the richtab, it doesn't help. I tried using ontabenter, it called my Javascript function below

function placeCurs开发者_JAVA技巧or() {
    jQuery("#send\\:emailAddress").focus();
    return false;
}

however, the cursor is not shown on the field.

If i call the same Javascript function from onclick of the richTabpanel that the tab is under it works and the cursor is placed. However, the onclick is called every time I click inside the tab. So even when I click on the next text field this Javascript is called and my cursor is moved to emailAddress field.


To debug the first thing you can do is output the length of the jquery query:

console.log(jQuery("#send\\:emailAddress").length)

If the number == 0 then you know the query failed. jQuery does not return null when querying, rather an array-like object + $.fn so that it can execute whether or not it found an element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜