I have page where I click on a link and change the content a of div with this code. I fill out that content with page1.php (it’s a form with some dropdown lists).
When I try to click on a dropdown list it resets it. How can I stop resting my from when I try to select something from a drop down list?
<script type="text/javascript">
$(function(){
$('#page1').click(function(){
pageUrl = 'page1.php';
LoadingPages(pageUrl);
})
function LoadingPages(pageUrl){
$('#content').load(pageUrl);
}
int = setInterval(function(){
LoadingPages(pageUrl)
},5000);
});
</script>
<a href="#" id="page1">something</a>
<div id="content">
As suresh.g mentioned, using onClick on an element gets fired even if you click any inner element. The workaround is to set an action on the inner elements, you want to be clicked and stop their event propagation UPWARDS in the DOM tree. Thus it will fire the inner event and stop it from moving outwords, this preventing your #content onclick. Code is something like that: