Ich habe Struktur wie jedes Bild unten eingegeben hat. Ich habe x Bilder auf dem Bildschirm. Jedes Bild hat eine OptionjQuery Finde den nächsten Eingang
onclick="imageClicked(this)"
Funktion erstellt Rahmen zu Bild und zeigt kollabierte Eingabe. Der Bildrand wird angezeigt, aber die Eingabe ist nicht sichtbar.
Hier `s die Funktion
function imageClicked(image) {
var input = $(image).closest("input");
$(image).css('outline', "solid 2px #5bc0de");
$(input).css("visibility", "visible");
$(input).focus();
$(input).focusout(function() {
$(image).css('outline', "0");
if ($(input).val() === "0") {
$(input).css("visibility", "collapse");
}
});
$(image).focusout(function() {
if ($(input).val() === "") {
$(image).css('outline', "0");
}
});
}
Hier ist HTML-Struktur in Razor Ansicht
@for (int i = 0; i < Model.Boxes.Count; i++){
var base64 = Convert.ToBase64String(Model.Boxes[i].Photo);
var imgSrc = String.Format("data:image/gif;base64,{0}", base64);
var imageId = Model.Boxes[i].BoxId;
@Html.HiddenFor(m => m.Boxes[i].BoxId)
<div class="col-md-2">
<img src="@imgSrc" width="50%" alt="@Model.Boxes[i].Name" id="@string.Format("image{0}", imageId)" onclick="imageClicked(this)" />
@Html.TextBoxFor(m => m.Boxes[i].Quantity, new { @class = "form-control", @style = "visibility: collapse; width: 50%; margin-top: 1%", @id = string.Format("input{0}", imageId) })
</div>
}
brauchen auch die HTML-Struktur .. –
'$ (Bild) .close (" Eingabe ");' aber 'engste()' sucht nach Vorfahren und weil ein 'inp ut' ist ein leeres Element, es kann keinen Nachkommen haben ... –