Jason Howard
Jason Howard

Reputation: 1586

Clicking submit button opens print preview

When clicking the submit button, within Chrome, the print preview window is opened just as it would if you pushed CTRL + P. I'm absolutely baffled. Also, nothing gets printed to the console even when text is entered into the 'myinput' input field.

html

                <div class="subscribeform">

                    <input class="myinput">

                    <input placeholder="Enter Email">

                    <button class="subscribesubmit1" type='submit'>
                        Submit
                    </button>

                </div>

javascript

<script type="text/javascript">

          $('.subscribesubmit1').click(function() {

            var myinput = $('.myinput').val();
            print(myinput)

        });   

</script>

Thanks for your help

Upvotes: 0

Views: 1451

Answers (1)

mark
mark

Reputation: 53

Try this:

$('.subscribesubmit1').click(function() {
    var myinput = $('.myinput').val();
    console.log(myinput);
});   

The print() method prints the contents of the current window.
And if you are new to javascript id suggest that you don't jump straight to jquery

Upvotes: 1

Related Questions