2
$.getScript("func2.js", function() {
$(".teste1").text("1");
$(".teste2").text("2");
});
<div class="teste1" style="color: red"><div>
<div class="teste2"><div>
'Cause he only inserted it once?
2
$.getScript("func2.js", function() {
$(".teste1").text("1");
$(".teste2").text("2");
});
<div class="teste1" style="color: red"><div>
<div class="teste2"><div>
'Cause he only inserted it once?
2
Because there is an error in your code, note that you have a comma, remove it that will solve.
Remove that comma at the end:
$(".teste1").text("1"),
To:
$(".teste1").text("1");
1
You have 3 errors in your code:
/
{
in the opening of the function;
and not ,
to separate the lines$(document).ready(function(){
$(".teste1").text("1");
$(".teste2").text("2");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="teste1" style="color: red"></div>
<div class="teste2"></div>
I hadn’t noticed! Thanks :) the error was in the div closing
1
I put your code on jsfiddle
, clear removing the name of the script and works, just fixing the tags that are wrong:
<div class="teste1" style="color: red"><div>
Should be:
<div class="teste1" style="color: red"></div>
And
<div class="teste2"><div>
Should be
<div class="teste2"></div>
That is, the tags div
are not being closed
I hadn’t noticed! Thanks :)
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
Sorry, I edited the question, the probelama is using the . getScript function
– Josimara
@Josimara try to close the Divs.
– Jhonatan S. Souza