I'm struggling with jQuery. Please help me...
When loading a page, the jQuery function is automatically executed, and at the same time, I'd like to implement this function in button click.
[Previously]
After loading the page, the jQuery function is automatically executed immediately.
And, there is no response when clicking the button.
html
<button type="button" class="btn btn-primary btn-sm" id="btn_add">LookUp</button>
jQuery
<script type="text/javascript">
$(function() {
..skip..
});
</script>
[Current situation]
After loading the page, the jQuery function is not automatically executed.
But It works well when clicking the button.
html
<button type="button" class="btn btn-primary btn-sm" id="btn_add" onclick="$(this).Lookup();">Lookup</button>
jQuery
<script type="text/javascript">
$.fn.Lookup = function() {
..skip..
};
</script>
[Goal]
Keep the jQuery function running automatically after loading the page.
Implement so that the jQuery function works even when clicking the LookUp button.
How should I fix this?