This was previously working fine for me but I think something changed how jQuery is being enqueued in WordPress.
$(document).ready(function () {
$('#dialog-modal').dialog({
modal: true,
autoOpen: false,
closeOnEscape: false,
bgiframe: true,
title: 'Please Confirm',
buttons: {
"Ok!": function() {
$(this).dialog("close");
}
}
});
$("[name='records']").on('change',function(e){
var selectedValue = $(this).val();
if(selectedValue==2) {
$('#dialog-modal').dialog('open');
}
});
});
My console displays :
Uncaught TypeError: $ is not a function
I referenced this question:
TypeError: $ is not a function when calling jQuery function
But I still don't know how to wrap this correctly.