how to avoid page reload in $(document).ready(function()

New Contributor

Hi Team,

 

After dropdown changevent completion page gets reloaded everytime. I want to stop after function execution. Kindly help.

 

<script type="text/javascript">

$( document ).ready(function()
{
alert('page load...');
$('select[id^="ctl00_ctl04_ctl00_ddlCrossWebLookupColumn"]').change(function()
{
alert('dropdown change event called');
functionTest();
});

 

});

function functionTest()
{
alert('change event function called...');
}

</script>

1 Reply
Your code should not reload the page, Do you get the "page load..." message twice?

Which browser are you using?

preventDefault() might help, change $('select[id^="ctl00_ctl04_ctl00_ddlCrossWebLookupColumn"]').change to

$('select[id^="ctl00_ctl04_ctl00_ddlCrossWebLookupColumn"]').change(function(e)
{
alert('dropdown change event called');
functionTest();
e.preventDefault();
});

Does the page reload with e.preventDefault()?