Reputation: 897
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 = $('#idofinputfield').val();
$(".iframe").colorbox({ href: "/newsletter-lightbox.aspx?id=" + str, iframe: true, innerWidth: 590, innerHeight: 500 });
});
</script>
Upvotes: 0
Views: 2012
Reputation: 9489
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 });
});
Upvotes: 1