Reputation: 9
I have script files that are global to all the pages and i want to attach window.onload to a specific view in asp.net mvc or element using jquery. Is that possible ??
Upvotes: 0
Views: 300
Reputation: 19113
You need to use .load()
to know if the content is loaded into the DOM. See the following example!
$('img').load(function() {
console.log('image loaded')
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="https://unsplash.it/200/300/?random" />
Upvotes: 1