# Check box function

**URL:** <https://www.phphelp.com/t/check-box-function/31570>\
**Category:** Help with WordPress\
**Created:** [April 11, 2020, 2:59pm UTC](https://www.phphelp.com/t/check-box-function/31570 "2020-04-11T14:59:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexYorks](https://www.phphelp.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@AlexYorks](https://www.phphelp.com/u/AlexYorks)\
**Post date:** [April 11, 2020, 2:59pm UTC](https://www.phphelp.com/t/check-box-function/31570/1 "2020-04-11T14:59:47Z")

</div>

ok so i have a check box which loads up on my page, and when you click on the check box it starts a function.

I changed it so when the page loaded the check box was selected, however the function that its supposed to do when selected doesnt work unless you select it off and on again? any ideas

---

<div class="post-metadata">

**Author:** ![frankbeen](https://www.phphelp.com/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@frankbeen](https://www.phphelp.com/u/frankbeen)\
**Post date:** [April 12, 2020, 10:27pm UTC](https://www.phphelp.com/t/check-box-function/31570/2 "2020-04-12T22:27:16Z")

</div>

Guess your talking about javascript right?

Javascript actions often work on events. For example a function may be run when a user hits a button.

If you want to execute a function immediately after page load you can call this function just on the first rule of your code.

---

<div class="post-metadata">

**Author:** ![AlexYorks](https://www.phphelp.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@AlexYorks](https://www.phphelp.com/u/AlexYorks)\
**Post date:** [April 13, 2020, 5:09pm UTC](https://www.phphelp.com/t/check-box-function/31570/3 "2020-04-13T17:09:40Z")

</div>

Right, I’ll have another look, thanks for the info
