Q:

Functioncall to javascript not working

i'm using php to generate some button that have their Id and the Id of the text they should show as parameters. But for some reason the function call doesn't seem to be working.

while($row=$query->fetch(PDO::FETCH_BOTH))
    {
      $reviewDoor=$row[0];
      $korteTekst=$row[1];
      $langeTekst=$row[2];
echo "<article><h4>Review van $reviewDoor</h4>";
echo "<section>$korteTekst</section>";
if (!empty($langeTekst))
{
echo "<section id='LongReview$teller' class='LongReviews'>$langeTekst</section>";
echo "<button id='LeesMeerKnop$teller' class='LeesMeerKnoppen' onclick='readMoreLess(LeesMeerKnop$teller,LongReview$teller)'>Lees meer...</button>";
}
echo "</article>";
    $teller++;

}

the file link is working

<script src="script.js" type="text/javascript"></script>

and this is the function I'm trying to call

function readMoreLess(knopId,tekst) {
var knop=getElementById(knopId);
        var review=getElementById(tekst); 
window.alert("hallo");
if (knop.textContent ==="Lees meer...")
        {
           knop.textContent="Minder tekst...";
           review.style.display="block";
    }
         else if (knop.textContent ==="Minder tekst...")
        {
        knop.textContent="Lees meer..."; 
                review.style.display="none";
        }
        }

A:

Looks like missing quotes on params values in function call:
 echo "<button id='LeesMeerKnop$teller' class='LeesMeerKnoppen' onclick='readMoreLess(\"LeesMeerKnop$teller\",\"LongReview$teller\")'>Lees meer...</button>";

