views:

164

answers:

2

I trying to store the value of the input field tbEmail into str so when the user clicks the submit button the value of tbEmail will be added to the querystring. If i change this so that it reads var str = "this"; then this works. Is this the incorrect way to get an iput field value in jquery? Any ideas?

<script type="text/javascript">

    $(document).ready(function () {
        var str = $('#').val();
        $(".iframe").colorbox({ href: "/newsletter-lightbox.aspx?id=" + str, iframe: true, innerWidth: 590, innerHeight: 500 });

            });
    </script> 

A: 

something has been stripped out of my question here. should read var str = $('#idofinputfield').val();

phil crowe
+1  A: 

var str = $('#idofinputfield').val();

is the correct way. only you dont bind your code to a click try:

$('.clickme').live('click', function() {
    var str = $('#').val();
    $(".iframe").colorbox({ href: "/newsletter-lightbox.aspx?id=" + str, iframe: true, innerWidth: 590, innerHeight: 500 });
});
Tim
ps colorbox supports ajax, try using that
Tim