how can get attributes of root element?

前端 未结 3 1520
余生分开走
余生分开走 2020-12-10 08:20


how can get attributes (rows) of root (data) element in jq

3条回答
  •  清歌不尽
    2020-12-10 08:54

    If it is a root node, use .filter() instead of .find().

    var records = $(xml).filter(":first").attr("rows");
    
    • http://api.jquery.com/filter/

    jQuery's .find() selects by searching inside the root nodes, while .filter() selects from among the root nodes.

提交回复
热议问题