У меня есть форма поиска с id sbox и контрольный список под ним. Я хотел бы установить событие ввода или фокусировку мыши, так что, когда кто -то выбран мышью в Sbox Div, первый элемент контрольного списка был пробитым. Он сейчас не работает на моем сайте. Мой jQuery ниже, но событие Enter Mouse не работает. Я также попробовал событие Focus, но оно не работает. < /P>
$(document).ready(function() {
$("#sbox").on('mouseenter', function() {
$("#item_0").prop("checked", true);
});
$(".website_checklist").contents().find(":checkbox").bind("change", function() { // Find all checkboxes in the div website_checklist on change
val = this.checked, $(this).parent().toggleClass("checked"); // Give this item the class "checked"
});
$(".website_checklist").contents().find(":checkbox").bind("focus", function() { // Find all checkboxes in the div website_checklist on bind
val = this.focused, $(".focus").removeClass("focus"), $(this).parent().addClass("focus"); // Remove all focus and then add focus class to this one
});
setTimeout(function() {
$("#calcsuccess").fadeOut("slow");
}, 3000);
$("#sbox").on("paste", function() {
setTimeout(function() {
$("#button-addon2").trigger("click");
});
});
var value = $('#sbox').val();
if (!$.trim(value) || value === null) {
$('#button-addon2').hide();
$('#image-upload').show();
} else {
$('#button-addon2').show();
$('#image-upload').hide();
}
});
function buttonChange(val) {
if (val) {
$('#button-addon2').show();
$('#image-upload').hide();
} else {
$('#button-addon2').hide();
$('#image-upload').show();
}
}< /code>
»
[img]assets/images/camera.png[/img]
[h4]Pre-launch checks[/h4]
[list]
[*]List item 1
[*]List item 2
[*]List item 3
[/list]
У меня есть форма поиска с id sbox и контрольный список под ним. Я хотел бы установить событие ввода или фокусировку мыши, так что, когда кто -то выбран мышью в Sbox Div, первый элемент контрольного списка был пробитым. Он сейчас не работает на моем сайте. Мой jQuery ниже, но событие Enter Mouse не работает. Я также попробовал событие Focus, но оно не работает. < /P>
$(".website_checklist").contents().find(":checkbox").bind("change", function() { // Find all checkboxes in the div website_checklist on change val = this.checked, $(this).parent().toggleClass("checked"); // Give this item the class "checked" }); $(".website_checklist").contents().find(":checkbox").bind("focus", function() { // Find all checkboxes in the div website_checklist on bind val = this.focused, $(".focus").removeClass("focus"), $(this).parent().addClass("focus"); // Remove all focus and then add focus class to this one });