i want to output some text in an label
<input type="text" size="20" maxlength="20" name="pizza1" value="Margherita">
is there a parameter that the text (value=Margherita) can't be changed, so the text is just displayed.
is input type= "text" the best way to output text? (later on the text is dynamic created)
thanks
what i understood from you is that you need a tag that shows only text
if I was not wrong in understanding you
the answer is in your title
use label tag
<label id="pizza1">Margherita<label>
or you can just disable the textbox
<input type="text" size="20" maxlength="20" name="pizza1" value="Margherita" disabled="disabled">
I hope this what you want
Related
I have problem with placeholders in Wordpress Onetone theme. When I change text in placehoder tags to my preferred text it works, until I press on that field again and then text resest to it's older text. For example, I change "Email" to word "whatever" , save it, go to website, it shows word "whatever" in input area, and when i press with mouse on that area and then somewhere else, it resets back to "Email". How I could make that my text in placeholder would be permanent?
<div class="contact-area">
<form class="contact-form" method="post" action="">
<input type="text" name="name" id="name" value="" placeholder="Name" size="22" tabindex="1" aria-required="true">
<input type="text" name="email" id="email" value="" placeholder="Email" size="22" tabindex="2" aria-required="true">
<textarea name="message" id="message" cols="39" rows="7" tabindex="4" placeholder="Message"></textarea>
<p class="noticefailed"></p>
<input type="hidden" name="sendto" id="sendto" value="tomas#bandymasvienas.esy.es">
<input type="button" name="submit" id="submit" value="Post">
</form>
</div>
I found a problem. If you want to be text all time same, you need to find your .js file with your desired function and edit text in there and placeholders will show text you want.
I have a form with some text fields,and I want to place the cursor (auto focus) on first text field of form when page gets loaded.
I want to do it without using javascript.
Ya its possible to do without support of javascript..
We can use html5 auto focus attribute
For Example:
<input type="text" name="name" autofocus="autofocus" id="xax" />
If use it (autofocus="autofocus") in text field means that text field get focused when page gets loaded..
For more details:
http://www.hscripts.com/tutorials/html5/autofocus-attribute.html
Just add autofocus in first input or textarea.
<input type="text" name="name" id="xax" autofocus="autofocus" />
This will work:
OnLoad="document.myform.mytextfield.focus();"
<body onLoad="self.focus();document.formname.name.focus()" >
formname is <form action="xxx.php" method="POST" name="formname" >
and name is <input type="text" tabindex="1" name="name" />
it works for me, checked using IE and mozilla.
autofocus, somehow didn't work for me.
An expansion for those who did a bit of fiddling around like I did.
The following work (from W3):
<input type="text" autofocus />
<input type="text" autofocus="" />
<input type="text" autofocus="autofocus" />
<input type="text" autofocus="AuToFoCuS" />
It is important to note that this does not work in CSS though. I.e. you can't use:
.first-input {
autofocus:"autofocus"
}
At least it didn't work for me...
very easy you can just set the attribute autofocus to on in the wanted input
<form action="exemple.php" method="post">
<input name="wantedInput" autofocus="on">
<input type="submit" value="go" >
</form>
Sometimes all you have to do to make sure the cursor is inside the text box is:
click on the text box and when a menu is displayed, click on "Format text box"
then click on the "text box" tab and finally modify all four margins (left, right, upper and bottom) by arrowing down until "0" appear on each margin.
Was using an asp: button but had to switch to
<input id="SubmitComments" type="button"
what are the attributes to add text to the btn on screen. similar to'text' attribute for asp:button
Also: instead of TextMode="MultiLine" rows=5, what can i use?
Ta
You can use button in Html as
<input type="button" value="Click Here" /> // value= Text to show
Submit button
<input type="submit" value="Click Here to Submit" />
Multiline TextBox
<textarea rows="10" cols="25" /> // can define rows and columns
Use value='your text' Attribute for the text of the button.
<input id='SubmitComments' name='SubmitComments' type='button' value='your text'/>
As for multiline, I assume that is for a text box. Buttons don't hear multiple lines.
Use a textarea element for multi line text input.
<textarea id='yourTextBoxName' name='yourTextBoxName' rows='5' />
<input type="submit" value="Submit">
use Value Attribute to add text to your input type button
I've create a RSS submission form and I want to show in the input box something like Enter your email here...., and when they click on it that message should be disappear and they can put their email in the box.
Here is the code I'm using at the moment
<div id="RSS">
<form action="http://feedburner.google.com/fb/a/mailverify" class="RSS" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=RSS', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<input type="hidden" name="uri" value="RSS">
<input type="hidden" name="loc" value="en_US">
<input name="email" id="RSS-text" type="text" maxlength="100" style="width:160px !important" value="Enter your email address..." class=""><button type="submit" id="RSS-button">Subscribe</button>
</form>
</div>
The problem is that it doesn't disappear when someone click on it, and I saw many forms including my search form it can be done that way.
You can use the placeholder attribute, but it doesn't support IE:
<input type="text" placeholder="Enter your text here..." />
Otherwise you can use a bit of javascript:
<input type="text" onfocus="if(this.value=='Enter your text here...') this.value='';" onblur="if(this.value=='') this.value='Enter your text here...';" value="Enter your text here..." />
Should we use <label> for every input? , even for submit button and keep hidden thorough css if we don't want to show label.
or no need of label for submit button?
.hide {display:none}
<fieldset>
<legend>Search</legend>
<label for="Search">Search...</label>
<input value="" id="Search" name="Search">
<label for="Submit" class="hide">Submit</label>
<input type="submit" value="Go!" name="submit" id="submit">
</fieldset>
or we should use like this (no label for submit)
<fieldset>
<legend>Search</legend>
<label for="Search">Search...</label>
<input value="" id="Search" name="Search">
<input type="submit" value="Go!" name="submit" >
</fieldset>
No. Don't use labels for elements which have intrinsic label text (e.g. all kinds of buttons). (Note: Faking a label with the value attribute doesn't count).
See the description section of the WCAG section on the subject.
From the official documentation:
The LABEL element may be used to
attach information to controls. Each
LABEL element is associated with
exactly one form control.
http://www.w3.org/TR/html4/interact/forms.html#edef-LABEL
Note that the term is "may be," not "must be." However, it is always a good idea to use a label because this turns out to be handy for accessibility reasons and for browsers running on touchscreen devices.