Javascript var in knockoutjs line

31 views
Skip to first unread message

dennisw...@gmail.com

unread,
Apr 24, 2014, 8:45:01 AM4/24/14
to knock...@googlegroups.com
I got some elements which have a visible binding,
Now im trying to change the true/valse of different bindings based on the id of the menu item that has been clicked on.

$("ul li a").click(function () {
               
var id = $(this).attr("id");
                viewModel
.id(true);
           
});


So im wondering how i can place any variable in the knockout line and still get it to work?

Thanks in advance!

Patrick Steele

unread,
Apr 25, 2014, 7:42:30 AM4/25/14
to knock...@googlegroups.com
Usually, with knockout, you use it's data-binding features and get away from DOM manipulation and jQuery selectors to modify the UI.  Could you explain in more detail exactly what you want to happen?  There's probably a knockout-way of doing it.

--
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.

Reply all
Reply to author
Forward
0 new messages