开发者

How to remove 'submit query' from a form submit?

开发者 https://www.devze.com 2022-12-09 05:25 出处:网络
I have an html form and the submit button 开发者_JS百科says \"submit query\". How can I remove this text? I am using a background image for the submit button and this text is messing up the button :(

I have an html form and the submit button 开发者_JS百科says "submit query". How can I remove this text? I am using a background image for the submit button and this text is messing up the button :( Any help would be greatly appreciated.


If you do not give your submit button a value

<input type="submit" />

instead of something like

<input type="submit" value="Submit" />

it will display 'submit query' by default. Try giving it a space &nbsp; as the value.


use:

<input type='submit' name='btnTest2' value=''>

Leave the value blank and there will be no words on the button. Since you're using a background image a for the button, give the button a height and width, otherwise it will display as a small gray blip (because there are no words on the button).


Background images are not content. If you want to use an image to tell people what a submit button will do, use a real image. As a bonus that allows you to provide alternative text for users who cannot see the image (e.g. because it failed to load or because they are blind).

<button type="submit">
    <img src="example.png" alt="Submit">
</button>


Just use the value attribute as shown below:

 <input value="Whateveryouwant" type="submit">


You just have to give it a value:

<input type='submit' name='btnTest'>
<input type='submit' name='btnTest2' value='Push Me'>

In the example above, btnTest renders as "Submit Query" while btnTest2 renders as "Push Me". Hope this helps.

UPDATE: You can do this to not display any text.

<input type='submit' name='btnTest2' value='' style="width:100px;">


Not sure if this was relevant then, but we would use type="image" rather than type="submit"


Just put a space between the value quotes. Simple fix.

Read the question before you reply. You may actually help someone.


Unfortunately, this does not work, at least not in a CMS. I've tried the space and the &nbsp; but IE8 will not recognize it. If I put the same in the value, it reverts back to 'Submit Query'. Just updating for anyone else who finds this method through a search.

EDIT : I added text indent: -9999px; to my CSS, and it seems that it worked. I still added the space in the value attribute for good measure.


I had this issue as well. If you don't set a value for a submit button it defaults to "Submit Query". I assume you are using an image for your submit button since you have the default value.

If you want to fix it for IE8 add a text indent using CSS which will push the default value off the screen.

text-indent:9999px;

If you want to fix it for IE9 you also need to change the default value because the text-indent doesn't work :( in your submit button add the following:

value=" "

I found this to work without a non-breaking space and tested it to my satisfaction on the IE's on browserstack. If you want to use the breaking space, feel free; I'll include the code.

value=" &nbsp; "

Also, thank you to the other stack-responders, you helped me fix this issue on IE9.

Also you inspired me to post my findings here and possibly help others!


If you are using something like a jQueryUI dialog button then you do not want to have the input button show up in the form, but rather just have it in the footer of the dialog. I accomplished this by doing the following:

Because IE will automatically put in an <input type="submit" /> I put this in the form instead: <input type="submit" style="display:none" />

Then later in the dialog JavaScript I put:

$("#register-dialog").dialog({
   title: "Register",
   modal: true,
   width: 700,
   buttons: {
            Register: function () {
                $('#registrationForm').submit();
            },
            Close: function () {
                $(this).dialog("close");
            }
        }
 });


Just remove the text with jQuery?

jQuery:

$('#btnSubmit').val('');


Plus the solutions mentioned with HTML and jQuery, you can put

font-size: 0px; 

for the input and it wouldn't show the text anymore.

This worked in my case.


that's it browser show default use this value="submit" is important


use attribute value="submit"


nothing just do this

    <input type="submit /"            

a slash with a space and u will not see the Submit or Submit Query no need to give value

0

精彩评论

暂无评论...
验证码 换一张
取 消