I have the following problem. I would like to use https://github.com/aehlke/tag-it/ in my project. However I am not sure how I am supposed to implement the following example given on the github page:
<script type="text/javascript">
$(document).ready(function() {
$("#myTags").tagit();
});
</script>
<ul id="myTags">
<!-- Existing list items will be pre-added to the tags -->
<li>Tag1</li>
<li>Tag2</li>
</ul>
So far I am able to manipulate the object:
val document = js.Dynamic.global.document
document.getElementById("myTags").innerHTML = "Test"
This works! Test
is being rendered.
When I call tagit()
instead I am being told that tagit is not a function
.
val document = js.Dynamic.global.document
document.getElementById("myTags").tagit()
When I do the "same" call with the chrome java script console everything works fine:
$("#myTags").tagit();
Can someone explain what I am doing wrong? Thank you in advance!
EDIT
It is not a problem of tag-it or jquery not being loaded. Again chrome console works. It is also not a loading issue. Even by clicking a button after everything is loaded for a 100% it doesn't work.
EDIT
Added my partial build defintion so everybody can see that the dependencies are correct:
.jsSettings(
jsDependencies ++= Seq(
"org.webjars" % "bootswatch-yeti" % "3.3.5" / "js/bootstrap.js" minified "js/bootstrap.min.js" dependsOn "jquery.js",
"org.webjars" % "jquery-ui" % "1.11.4" / "jquery-ui.js" minified "jquery-ui.min.js" dependsOn "jquery.js",
"org.webjars" % "tag-it" % "2.0" / "js/tag-it.js" dependsOn "jquery.js" dependsOn "jquery-ui.js"
),
libraryDependencies ++= Seq(
"io.github.widok" %%% "widok" % "0.2.2" exclude ("org.webjars", "bootstrap"),
"be.doeraene" %%% "scalajs-jquery" % "0.8.0",
"com.lihaoyi" %%% "scalatags" % "0.4.6",
"org.webjars" % "bootswatch-yeti" % "3.3.5",
"org.webjars" % "font-awesome" % "4.4.0",
"org.webjars" % "jquery-ui-themes" % "1.11.4"
),
persistLauncher := true
)