简体   繁体   English

将结果打印到输入框而不是 URL

[英]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.

相关问题 显示一个 <input type=“checkbox”> 元素,中间有一个方框,而不是选中标记 - Display a <input type=“checkbox”> element with a box in the middle rather than a checkmark window.open(url) 在新标签页中打印 url 而不是打开 url - window.open(url) print url in new tab rather than opening the url 在 object 中消毒 url 而不是单个 url - Sanitize url in an object rather than single url 警报栏而不是警报框 - Alert Bar rather than alert box 如何将 append 文件从 url 或服务器上的文件而不是文件输入转换为 FormData() - How to append a file to a FormData() from an url or file on server rather than a file input 我可以在对话框中而不是在“警告”中在画布中显示在游戏中获胜或失败后得到的结果吗? - can I Show the result that comes after winning or losing game inside the canvas in a dialog box rather than usin “Alert”? Sequelize.or返回Limit 1而不是结果 - Sequelize.or returns Limit 1 rather than or result 为什么结果数组以 0 而不是 1 开头? - Why does the result array start with 0 rather than 1? 在警报框中打印功能的结果 - Print the result of a function in an alert box xmlhttp来自变量而不是URL-javascript - xmlhttp from variable rather than url - javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM