Webdev Tory
Webdev Tory

Reputation: 515

cljsjs jquery rewrite in my clojurescript app

My program was built such that the following line works under simple compilation (e.g. with Figwheel):

(-> (js/jQuery "document") (.ready #(.tooltip (js/jQuery "[data-toggle='tooltip']"))))

I need it to work under advanced compilation so I've installed and required cljsjs/jquery. However, I'm not sure how to rewrite the above code to utilize cljsjs. I know that (js/jQuery.) returns a thing, which I can then .init, but I'm really flying in the dark here. What's the equivalent cljsjs version of the working code above?

Upvotes: 3

Views: 247

Answers (1)

Webdev Tory
Webdev Tory

Reputation: 515

What works as js/jQuery "document" in simple compilation can, after including cljsjs/jquery be done with js/$ "document" . For the tooltips you actually need cljsjs/bootstrap, however, after which the new line is:

(-> (js/$ "document") (.ready #(.tooltip (js/$ "[data-toggle='tooltip']"))))

Upvotes: 2

Related Questions