Today I stumbled across this problem when I try to dynamically add an input tag to a row in a table.
"SyntaxErrpr: missing ) after argument list"
The code I used:
//creates a input element based on the fieldname, fieldvalue and fieltype.
public function createInput($aFieldName, $aFieldValue, $aInputType)
{
echo '<script>';
echo '$("#TableContainer tr:last").';
echo 'append($("<tr><td>"'.$aFieldName.'"</td><td><input type="'.$aInputType.'" name= "'.$aFieldName.'"></td></tr>"));';
echo '</script>';
}
edit
input:
fieldname = classnumber,
fieldvalue = classnumber,
inputetype = text,
When I use it without using the variables it somehow works and doesn't give me the error mentioned above.
//creates a input element based on the fieldname, fieldvalue and fieltype.
public function createInput($aFieldName, $aFieldValue, $aInputType)
{
echo '<script>';
echo '$("#TableContainer tr:last").';
echo 'append($("<tr><td>test</td><td><input type=\"test\" name=\"test\"></td></tr>"));';
echo '</script>';
}
edit