0

I am working on a multilingual website on wordpress.

I need to have different taglines on the french side and on the English side.

In html for menu header I have both taglines :

<p id='conditional'><h2 style="color: rgb(125, 119, 119); font-family: 'Courgette', cursive; margin-top: 20px;">Écouter, observer, questionner pour se rencontrer soi-même et rencontrer l'autre</h2></p>
<p id=‘conditional2’><h2 style="color: rgb(125, 119, 119); font-family: 'Courgette', cursive; margin-top: 20px;">to listen and all </h2></p>

and in JS i have a condition for printing one tagline only :

<script type="text/javascript"> 
$(document).ready(function() {
    if (window.location.href.indexOf("en") > -1) {
                  $('#conditional').css('visibility', 'hidden');
alert("ENGLISH");
}
        else {
                  $('#conditional2’).css('visibility', 'hidden');
alert("FRENCH");
}
    });
</script>

In console, i got this error :

Uncaught SyntaxError: missing ) after argument list

on this line

$('#conditional2’).css('visibility', 'hidden');

Can somebody help me, I am just trying to print one tagline or an other if i am on the french side or on the english one.

U can see how is it working on https://isabellemillon-pratique-philosophique.com/en/home/ or https://isabellemillon-pratique-philosophique.com/

El-j Blaack
  • 23
  • 1
  • 5
  • 1
    Typo: Replace `’` character with `'` character and try again. – Tân Feb 17 '20 at 11:22
  • `$('#conditional2’).css('visibility', 'hidden');` there is quote wrong after `2` start quote is different and ending quote is wrong please correct them and use `'` – Krunal Prajapati Feb 17 '20 at 11:22
  • Try this **$('#conditional2').css('visibility', 'hidden');** The quotation marks in you script looks incorrect. – Kawaljit Singh Feb 17 '20 at 11:22
  • Thanks a lot, there is no more error in console, but the 2 tagline are still printed. Anybody have an idea ?? – El-j Blaack Feb 17 '20 at 11:39
  • What version of jquery are you using? – Michel Novellino Feb 17 '20 at 12:02
  • Change your paragraph tags to divs and I think you'll be set. Having heading tags inside p tags is not valid. https://stackoverflow.com/questions/4675985/how-to-use-an-h2-tag-h2-inside-a-p-p-in-the-middle-of-a-text – Tom Woodward Feb 17 '20 at 13:34

0 Answers0