I want some elements to be highlighted on this web page when you click on one of them, but if you click elsewhere on the page, all these elements will no longer be highlighted.
I performed this task as follows, and it works fine, except for one thing (described below):
$(document).click(function() {
$(".suggestion_box").css('background-color', '#FFFFFF');
});
$(".suggestion_box").click(function() {
return false;
});
function clickSuggestion() {
$(".suggestion_box").css('background-color', '#FFFFFF');
$("div[name=" + arguments[0] + "]").css('background-color', '#CCFFCC');
}
This way to force the selection of elements works fine until I add more html to the page without loading a new page. This is done using .append () and .prepend ()
, , , "" , . , , ///onclicks ect, , ( ).
, , , , , . , pageload?
, , , , , , -. , .