Limiting function called on load of subpage to the elements of this subpage.
Hi,
I got a div on main page and on subpage, which load after a menu click.
I want to edit a div on subpage load, but without altering div on the main page (both have same class and i want this function to be universal).
This doesn't work, becouse after subpage load it also modifies div on the main page.
$(function(){
$("div.a").html("yyy");
});
As for now i come up with this solution (but I think it doesn't look elegant):
I added a flag (value attr) which tells if div was previously modified.
$(function(){
$("div.a").each(function() {
if($(this).attr('value')=='0') {
$(this).attr('value','1');
$(this).html("yyy");
} else
});
});
Any thoughts?
Thanks in advance,
ent.