I have a page in which there is some text that needs to be in two languages. Here is my code:
$('#english').hide();
$('#enButton').on('click', function() {
$('#english').fadeIn();
$('#french').fadeOut();
});
#french {
margin-top: 40px;
}
#english {
display: block;
position: absolute;
top: 90px;
left: 150px;
}
#frButton {
top: 30px;
left: 145px;
position: absolute;
cursor: pointer;
}
#enButton {
top: 30px;
position: absolute;
right: 135px;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section id="content">
<div id="container">
<div id="about" class="sections">
<div id="frButton">
<p>FRA</p>
</div>
<div id="enButton">
<p>ENG</p>
</div>
<div id="textContainer">
<div id="french">
<p>Text in French.... </p>
</div>
<div id="english">
<p>Text in English...</p>
</div>
</div>
<!-- end of textContainer -->
</div>
</div>
<!-- end of content -->
</section>
<!-- end of container -->
The last two rules are for buttons. When you click on the "English" button I want to trigger some jQuery to hide the French text and make the English appear and then do the opposite when you click back on "frButton". But this is not working and I have both texts on top of each other as the method
$( '#english' ).hide();
is not even working. I have been at this for an hour now and the #english id is not being targeted at all. Any ideas why?
The content of "about" is loaded using ajax by the way.