문제

I have an item view that looks like this:

MyView = Marionette.ItemView.extend({
  template: "#static-template"

  onRender: function() {
    console.log($('#static-template').val())
  }
});

I want to use jQuery to select the #static-template element, but I am unable to do. How can I select this element with jQuery inside a Marionette.ItemView?

도움이 되었습니까?

해결책

Use this.$el. In your case, this.$el.attr("value");

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top