Which html element should I use when using a Label for text?
I need to set the text of the element to a client name that is selected from an jqueryui autocomplete control.
I’ve tried using a span, which works in Chrome but not in IE. Is there a recommended way of doing this?
html:
<p>
<label for="ClientLabel">Client:</label>
<span id="ClientLabel" style="width: 160px; font-weight: bold;" />
</p>
autocomplete javascript:
$('#ClientSearchAutocomplete').autocomplete(
{
source: "/Report/ClientAutocompleteJSON",
select: function (event, ui) {
$('#ClientLabel').text(ui.item.value);
$('#ClientLabel').val(ui.item.id);
}
});
Input with type text has a text value and a
readonlyproperty. It will look like a input box which you may want to style so as not to confuse the user.