Bind price and decimal input events to body in woocommerce_admin js
The event was bound to the element directly, causing problems when the elements was added after dom ready (through ajax). Now the decimal format check will always take place.
This commit is contained in:
parent
3d584bc09a
commit
e0dc31620b
|
@ -4,14 +4,12 @@
|
|||
jQuery(function(){
|
||||
|
||||
// Price input validation
|
||||
jQuery(".wc_input_decimal[type=text], .wc_input_price[type=text]")
|
||||
.bind( 'blur', function() {
|
||||
jQuery('body').on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text]', function() {
|
||||
jQuery('.wc_error_tip').fadeOut('100', function(){ jQuery(this).remove(); } );
|
||||
return this;
|
||||
});
|
||||
|
||||
jQuery(".wc_input_price[type=text]")
|
||||
.bind( 'keyup change', function() {
|
||||
jQuery('body').on('keyup change', '.wc_input_price[type=text]', function(){
|
||||
var value = jQuery(this).val();
|
||||
var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.mon_decimal_point + "]+", "gi" );
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
@ -30,8 +28,7 @@ jQuery(function(){
|
|||
return this;
|
||||
});
|
||||
|
||||
jQuery(".wc_input_decimal[type=text]")
|
||||
.bind( 'keyup change', function() {
|
||||
jQuery('body').on('keyup change', '.wc_input_price[type=text]', function(){
|
||||
var value = jQuery(this).val();
|
||||
var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.decimal_point + "]+", "gi" );
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
|
Loading…
Reference in New Issue