Toggle Button add value all page
-
how do i get the code below to be selected on all pages and send the selected value to database
<html>
<body><button id=”toggle” name=”test” onclick=”myFunction()”>on</button>
<script>
function myFunction() {
var change = document.getElementById(“toggle”);
if (change.innerHTML == “on”)
{
change.innerHTML = “off”;
}
else {
change.innerHTML = “on”;
}
}</script>
</body>
</html>function update_your_meta_key( $post_id ) {
if ( isset( $_POST[‘test’] ) ) {
update_post_meta( $post_id, ‘your_meta_key’, $_POST[‘test’] );
}
and if it’s not too much to ask to update this plugin without reloading the page
- The topic ‘Toggle Button add value all page’ is closed to new replies.