Jquery – how to change div text after form submit

jquery

i have a form to enter directions and display a google map

<form action="#" onsubmit="setDirections(this.from.value, 'address', 'en_US'); return false">

Outside the form i have the following:

Formatted Directions<div id="printdirec"><a href="http://maps.google.com/">Print Directions</a></div>

i want to change the value inside the div tag 'printdirec' to say something else

i tried this (which i thought would work) but it doesn't:

    <script type='text/javascript'>
        $(document).ready(function() {

        $(":submit").click(function(e) {
                $('div.printdirec').val('tttt')
            });

        });
</script>

any suggestions of what i am doing wrong?

Best Answer

The # symbol identifies the ID of the element. Use .text() to set the inner text.

$('div#printdirec').text('tttt');