kLai
kLai

Reputation: 269

Giving an html template text using jquery

I am currently loading an html template into my index.html using:

$("#x").load("template.html");

and my template file is something like:

<html>
  <div id="textBox">
  </div>
</html>

Is it possible for me to give the template text from the index.html?

Thanks for your time, LL

Upvotes: 0

Views: 57

Answers (1)

outlyer
outlyer

Reputation: 3943

Add the text from a callback in load()'s complete argument:

$("#x").load("template.html", function() {
    $("#textBox").html("Added text");
});

Upvotes: 1

Related Questions