[英]Print result into input box rather than into URL
I would like to print the result value into an input box that looks like this for example:我想将结果值打印到如下所示的输入框中,例如:
<input type="text" id="mylink"/>
Rather than automatically updating the URL, is it possible to replicate current functionality into a text box rather than update in the URL so that the end result is copyable URL links?是否可以将当前功能复制到文本框中而不是在 URL 中更新,而不是自动更新 URL,以便最终结果是可复制的 URL 链接?
An example of the current script in action is available athttp://www.catchingtherain.com/wpdatatables-merged-column-test/当前正在运行的脚本示例可在http://www.catchtherain.com/wpdatatables-merged-column-test/ 获得
Currently, any filters applied are automatically put into the URL.目前,任何应用的过滤器都会自动放入 URL。 I have tried what I can but seem to run into errors trying to get this thing to work but again I'm not the best at Javascript after all.我已经尽我所能,但似乎在试图让这件事工作时遇到了错误,但我毕竟不是 Javascript 中的佼佼者。
jQuery(window).load(function(){
wpDataTables.table_1.addOnDrawCallback(function(){
var params={};
jQuery('.wpDataTableFilterSection').each(function(i, obj) {
if ( inputbox = obj.id.match("table_1_(.+)_filter_sections") ) {
if (jQuery(obj).find('input').val()) {
var key='wdt_column_filter['+inputbox[1]+']';
params[key] = jQuery(obj).find('input').val();
}
}
});
history.pushState('','','?'+jQuery.param(params));
});
});
Replace代替
history.pushState('','','?'+jQuery.param(params));
with和
jQuery("#mylink").val(jQuery.param(params))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.