根据子类获取父div的索引

时间:2018-01-08 06:38:23

标签: jquery

  var index = $(this).parent().parent().parent().parent().parent().parent().index(".fc-row.fc-week.fc-widget-content"); 

我这样做是为了获得父母的索引。可以有任何其他选项来编写此代码

2 个答案:

答案 0 :(得分:0)

您可以将parent()与包含closest()的容器的选择器一起使用{/ 1}},而不是多次使用".fc-row.fc-week.fc-widget-content"函数

var index = $(this).closest('someselectorhere').index(".fc-row.fc-week.fc-widget-content"); 

答案 1 :(得分:0)

简单使用

object EventStoreTopology {

  type Persistent = Materialized[String, String, KeyValueStore[Bytes, Array[Byte]]]
  val StoreName: String = "EventStore"
  val Store: Persistent = Materialized.as(StoreName)

}