Hey James,
It looks like the enter keydown event is not working on the select2.js
I made this to call the wp_insert_term() and when changing the keycode its working but when using keycode 13 its not working:
jQuery(".acf-taxonomy-field").keydown(function (e) {
var code = e.keyCode || e.which;
if(code == 13) {
var post_id = jQuery(".select2-search-field input").val();
jQuery.ajax({
type:"POST",
url: ajaxurl,
data: {
action: "formulier_ajax_request",
id: post_id
},
success:function(data) {
alert('Toegevoegd');
},
error: function(errorThrown){
alert(errorThrown);
}
});
}
});
This works great..!
Is it also possible to add a new tag when typing and pressing enter?