JavaScript How to NOT display text in a text field display text text,display text from text file in html,

Here is my version

Live Demo

$(function() {
  $("form").on("submit",function(e) {
    var zip = $("#google").val();
    var what = $("input[name='what']:checked").val();
    what=what?zip+" "+what:zip;  
    if (what) $("#google").val(what);
    else e.preventDefault();  
  });
});    

You may want to reset the field by removing the radio value from it when focussing the field

Answer:1

I think you'd want to tie a function to the submit button and in there prefix the input ed value with "public library " or "subway OR FedEx"

Answer:2

Why not just use ajax to send your requests to google, then you could control exactly how things are handled in every event. It also would remove the need for a page refresh or pop-up window that could be blocked by pop-up blockers?

$("input[name=search]").change(function () {
     //alert($(this).val());
     option = $(this).val();
     var $url = "https://www.google.com/search/" + option;
     $.ajax({
         url: $url,
         type: 'GET',
         beforeSend: function () {
             //do something before submitting
         },
         success: function (data, textStatus, xhr) {
             //success do something with the data you get back
             console.log(data);
             $("#results").html(data);
         },
         error: function (xhr, textStatus, errorThrown) {
             //something broke
             $("#results").html(errorThrown);
         }
     });
 });


    <form>
        <table border="0" cellpadding="0">
            <tr>
                <td>
                    <input type="text" name="q" size="25" maxlength="50" value="" id="google" />
                    <input type="submit" value="Search" />
                </td>
            </tr>
            <tr>
                <td align="center" style="font-size:75%">
                    <input type="radio" id='radiobtn1' name="search" value="Libraries" />Libraries
                    <input type="radio" id='radiobtn2' name="search" value="Fax" />Fax
                    <!--<input type="radio" name="search" value="google.com" onclick="act('ice cream ')"/>Ice Cream--></td>
            </tr>
        </table>
    </form>
    <div id="results"></div>
Answer:3

I want clocks displaying different time zones on a webpage that i am designing.For this,i have embedded the javascript files from a webiste called qlock.The HTML code is as follows: <script type="...

I want clocks displaying different time zones on a webpage that i am designing.For this,i have embedded the javascript files from a webiste called qlock.The HTML code is as follows: <script type="...

  1. css align blocks horizontally
  2. align div blocks horizontally

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...

I want to know if it is possible to use ng-repeat in a model that look like this: Example Model: $scope.items = { item1:{[1,2,3,4,5]}, item2:{[a,b,c,d,e]}, item3:{[a1,b2,c3,d4,e5]} }; The ...

I want to know if it is possible to use ng-repeat in a model that look like this: Example Model: $scope.items = { item1:{[1,2,3,4,5]}, item2:{[a,b,c,d,e]}, item3:{[a1,b2,c3,d4,e5]} }; The ...