Cannot get inner text of input tag

The alert box appears, but is empty.  I want it to show the contents of the input tag with name="search".



 $('input[value="go"]').click(function ()
        {
            //$('input[class="searchbox"]').css("border", "3px solid yellow");
            alert($('input[class="searchbox"]').text());
            //document.location.href = "/search.aspx?search=" + $('input[class="searchbox"]').html;
        });

here is the markup:

<div class="utenn_search" id="utbk_searcAh">
          <label for="search">search: </label>
          <input type="text" name="search" class="searchbox" value="Search" onfocus="this.value=''" title="search">
      <input name="go" class="submit" type="button" value="go">
</div>
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?
 
haloexpertsexchangeConnect With a Mentor Commented:
try getting the value instead of the text, if it is empty then nothing has been set for the text.
0
 
leakim971Connect With a Mentor PluritechnicianCommented:
alert($('input[class="searchbox"]').val());
0
 
leakim971PluritechnicianCommented:
alert($('input.searchbox').val());

or :

alert($('.searchbox').val());
0
 
Tom KnowltonWeb developerAuthor Commented:
thx, that was it.
0
All Courses

From novice to tech pro — start learning today.