Skip to content

Instantly share code, notes, and snippets.

@billdozr
Forked from ryancrum/jquerytest.cljs
Created July 25, 2011 23:32
Show Gist options
  • Save billdozr/1105542 to your computer and use it in GitHub Desktop.
Save billdozr/1105542 to your computer and use it in GitHub Desktop.
How to use jQuery from ClojureScript
(ns jquerytest.core)
(def jquery (js* "$"))
(jquery
(fn []
(-> (jquery "div.meat")
(.html "This is a test.")
(.append "<div>Look here!</div>"))))
<html>
<head>
<script type="text/javascript" src="out/goog/base.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="jquerytest.js"></script>
<script type="text/javascript">
goog.require("jquerytest.core");
</script>
</head>
<body>
<div class="meat">Replace me, jquery.</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment