i'm trying to get the VALUE
orid
from the a tag
and use it inside function here is my javascript
code
function myFunction(qiizName,x) {
val=1;
console.log("question number" +qiizName);
console.log("nmber questuion" +x.value);
console.log("nmber questuion" +x.id);
}
i try same code in other project it's work but in this case doesn't work at all it return undefined in console here is where i call myFunction()
echo"<ul>";
echo "<li><a href='#home' class='active' >module</a></li>";
$i=0;
while ( $module_row = mysqli_fetch_array($module)) {
$total=$module_row['total_question'];
$id=$module_row['id'];
echo '<li><a href="javascript:myFunction(1,this)"
id="'.$total.'"
value="'.$total.'">\''.$module_row['nom'].'\' </a></li>';
//$php_array = array_push($php_array, $module_row['total_question']);
$i++;
}
echo "</ul>";
for example <a href="javascript:myFunction(1,this)" id="2" value="2">'cpp' </a>
i want to get value
2 and id
2
Aucun commentaire:
Enregistrer un commentaire