I am working on some code that is based on a tutorial that uses jQuery's $(document).ready
, which starts the work as soon as the page is loaded (or the document is ready). The code is pretty standard (from what little I know about jQuery) and does work when the page loads.
$(document).ready(function () {
// Do stuff here
});
But now I want to change it so that the code runs from a functions instead. My first thought was that I could just change the function to this
$(function dothis() {
// Do stuff here
});
and then call it with a dothis(); but when I did that I get a "dothis is not defined" error. I have also tried it a few different ways and have not been able to figure this out. What do I need to do to make this work the way that I want it to?
function searchCustomers() {
var searchvalue = document.getElementById('searchText2').value;
var searchtype = document.getElementById('searchType2').value;
//Just checking to make sure this part is working...
//alert(searchtype + ' ' + searchvalue)
// Run the "Do Stuff here"
var showDiv = document.getElementById('divCustomerGrid');
showDiv.style.display = 'block';
};