Get value from Javascript to HTML in Laravel

I want to ask that how can I call a value from javascript to html blade in laravel.

Here is my JavaScript code:

<script type="text/javascript">
    function valueFunction(){
        var output = document.getElementById('teacherId').value;
        console.log(output);
        document.getElementById('output').innerHTML = output;
    }
</script>

Here is my Laravel Html:

{{$users[]->name}}
<output id="output"></output>

As I am getting the value in output tag, but I want to call the value of javascrpt in {{$users[output]->name}} here.

Thank you.

#javascript #html #css #laravel

2 Likes18.50 GEEK