Im new to Javascript and was wondering how i would write a function (using jQuery) that takes a paramater, and based on that returns different code. I will write the function in PHP so you understand what im trying to do.
<?php
function direction( $l_r )
{
if ($l_r == 'left') $dir = '-';
elseif ($l_r == 'right') $dir = '+';
echo 'the direction is '. $dir;
echo '(than theres some more going on here)';
}
?>
1 Answer