get DOM element from viewmodel

44 views
Skip to first unread message

giko

unread,
Jul 22, 2015, 9:23:27 AM7/22/15
to KnockoutJS
Hi,

How do i get the DOM element that the viewmodel is bound to from the viewmodel without custom bindeings etc.?  

I want to be able to do:

function vm(params) {
      var self=this;
      $( get the DOM element )
}


regards G





Gunnar Liljas

unread,
Jul 22, 2015, 9:46:29 AM7/22/15
to knock...@googlegroups.com
You don't, but maybe you already know which element it is?

--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

giko

unread,
Jul 22, 2015, 10:07:48 AM7/22/15
to KnockoutJS
No, i don't know the element(elements id) since i am using multiple instances of the component.

So i guess the answer is no than ;(.

I'll give it a try than with a custom binding.




Reply all
Reply to author
Forward
0 new messages