到目前为止,我需要更改 Adobe Business Catalyst 中无法访问的模块中的文本,但是一旦更新了屏幕上的选项,脚本就不会再次运行。我如何让它自动刷新/运行?
$(document).ready(function(){
$.fn.replaceText = function( search, replace, text_only ) {
return this.each(function(){
var node = this.firstChild,
val,
new_val,
remove = [];
if ( node ) {
do {
if ( node.nodeType === 3 ) {
val = node.nodeValue;
new_val = val.replace( search, replace );
if ( new_val !== val ) {
if ( !text_only && /</.test( new_val ) ) {
$(node).before( new_val );
remove.push( node );
} else {
node.nodeValue = new_val;
}
}
}
} while ( node = node.nextSibling );
}
remove.length && $(remove).remove();
});
};
$("#shippingStateSpan").replaceText( "Destination State", "Do you have a VAT number?" );
});
任何帮助将不胜感激。谢谢