I'm using ACF - Advanced custom fields and I have two fields Price text (text field) and Price Filter (number).I want to achieve that when I enter a value in one field (Price Text field ) to automatically copy into another field (Price Filter field). Does anyone have an idea how to do this?
Advanced custom fields will add ids to your input fields in the edit screen. You can leverage that and create a small jQuery script that copies the content of your first field to your secondary field while you type. Something like this should work:
add_action('admin_footer', function () {
?>
<script type="text/javascript">
$('#acf-field_5c19647c09c56').on('keyup', e => {
$('#acf-field_5c19648909c57').val(parseFloat(e.target.value));
})
</script>
<?php
});
Remember to replace acf-field_5c19647c09c56
with the id of your Price Text field and acf-field_5c19648909c57
with the id of your Price Filter field.
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.