How to get value from Select html element using JS prototype in php?

<script type="text/javascript" src="prototype.js"></script>
    <script>
    function reload(form){
    var val = $("seltab");alert(val);
    }</script>
echo "<form method = post name = f1 action = '' >";
    echo "<select id = seltab onchange =  'reload(this.form)'>";
        $querysel = "SELECT title_id,author FROM authors NATURAL JOIN books";
    $result1 = mysql_query($querysel) ;
    while($rowID = mysql_fetch_assoc($result1))
    {
        $TitleID = $rowID['title_id'];
        $author = $rowID['author'];
        print "<option value =$TitleID>$author\n";
        print "</option>";
    }
    print "</select>";
+3
source share
1 answer

I think he means only a small part of javascript to get the value from the select box in its reload function:

$("seltab").getValue();

The API seems to say that even for this briefly: ( http://api.prototypejs.org/dom/form/element/getvalue/ )

$F("seltab")
+8
source

Source: https://habr.com/ru/post/1739951/


All Articles