ohad Posted April 2, 2021 Share Posted April 2, 2021 Hi I have a query script whick is triggered on click event of button which its id is "save_rows" When the user manually press the save button, the script works as I want This script header looks like that: $(document.body).on('click', '#save_rows', function(e) { In another place in my app i need to use the same script, but from another jquery script. Is there a way I can call this script from inside another jquery script? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/312412-call-jquery-script-from-another-jquery-script/ Share on other sites More sharing options...
kicken Posted April 2, 2021 Share Posted April 2, 2021 Make the function a named function, function saveRows(){ //... } Then just reference it in both places. Pass a reference to it for your event handler $(document.body).on('click', '#save_rows', saveRows); And call it in your other location. saveRows(); Quote Link to comment https://forums.phpfreaks.com/topic/312412-call-jquery-script-from-another-jquery-script/#findComment-1585571 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.