简体   繁体   中英

How to make a button load a function on itself when it is inserted

At the moment my script is layered out like so...

PHP Echos out button.

Jquery UI button function to apply on the object that the function was called by.

Is there a way to make the button perform MyAddButtonFunction(this) when the button is inserted. (Note there are multiple buttons)

Do you mean

echo '<input type="button" id="button1" />';
echo '<script>MyAddButtonFunction($("#button1"))</script>'

or is this ajaxed in?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM