Find an element by CSS selector in GWT

后端 未结 5 1848
不思量自难忘°
不思量自难忘° 2021-01-11 09:21

I\'m trying to grab an arbitrary element using a CSS selector (eg. \"#someId .className a\") in GWT.

I\'m building a JS widget that can live on a 3rd party website a

5条回答
  •  -上瘾入骨i
    2021-01-11 09:47

    Use GwtQuery, is updated to GWT 2.4: http://code.google.com/p/gwtquery/

    Selector examples :

    //select an element having id equals to 'container'
    GQuery myElement = $("#container");
    //select all elements having 'article' as css class
    GQuery allArticles = $(".article");
    /select all cells of tables
    GQuery allCells = $("table > tr > td");
    //find the ul elements being inside a element with class 'article' itself inside a element with id 'container'
    GQuery articleUls = $("#container .article ul");
    

    http://code.google.com/p/gwtquery/wiki/GettingStarted

提交回复
热议问题