开发者

simple jquery question [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I have the following HTML.

<input type="text" class="embeddedLabel" />

And I wish to tie a function to the f开发者_C百科ocus event of the textbox with...

$(document).ready(function(){
    $(input[@class = 'embeddedLabel'].focus(function(){
        alert('embeddedLabel textbox found');
    });
};

However, I can't make this work. The alert never fires when I click in the textbox. Is it obvious to anyone what the issue is here?


You're missing some quotes:

$("input[@class = 'embeddedLabel']")


Try this:

$(document).ready
(
    $(input[@class = 'embeddedLabel']).bind("focus",function(){
        alert('embeddedLabel textbox found');
    });
};
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜