JavaScript can not find component id..?

Hello,

My code as follow and Javascript doesn’t find any component…Maybe javascript load firstly may be other… Can you tell me what’s wrong?

Thanks…

Tab myTab = new Tab();
myTab.setId("componentId");
JavaScript.getCurrent().execute("$(document).ready(function(){ "+
                    "$('#componentId').click(function(){ "+
                    "alert('clicked..');"+
                    "});"+
                    "});");

Hi,

You use jquery in your JavaScript but have you loaded the jquery in your page? You can do that with @JavaScript annotation. For example, this wiki article uses the annotation
https://vaadin.com/wiki/-/wiki/Main/Integrating+a+JavaScript+component