我只是添加一个DOM上的元素,如:
$("#div_element").append('<a href="#">test</a>');
Run Code Online (Sandbox Code Playgroud)
在我追加它之后,我需要访问我刚刚创建的元素以便将click函数绑定到它,我试过:
$("#div_element").append('<a href="#">test</a>').click(function(){alert("test")});
Run Code Online (Sandbox Code Playgroud)
但上述方法无效.我可以唯一地识别元素,但这似乎有点工作,或许有一种方法,我可以在我追加它后立即获得元素.
我正在写一个bash脚本,我试图提交一个post变量,但是wget将它视为多个URL我相信因为它不是URLENCODED ...这是我的基本思想
MESSAGE='I am trying to post this information'
wget -O test.txt http://xxxxxxxxx.com/alert.php --post-data 'key=xxxx&message='$MESSAGE''
Run Code Online (Sandbox Code Playgroud)
我收到错误并且alert.php没有得到post变量加上它很难说
无法解决我无法解决我无法解决尝试..等等.
我上面的例子是一个简单的有点sudo示例,但我相信如果我可以对其进行url编码,它会通过,我甚至尝试过像:
MESSAGE='I am trying to post this information'
MESSAGE=$(php -r 'echo urlencode("'$MESSAGE'");')
Run Code Online (Sandbox Code Playgroud)
但PHP错误..任何想法?如何在没有php执行的情况下传递$ MESSAGE中的变量?
Prolly一个简单的..我正在尝试研究mod_rewrite并遇到了一个问题
这是我的网址
example.com/index.php?id=1&title=some_title
Run Code Online (Sandbox Code Playgroud)
我希望页面能够采取
example.com/1/some_title.html
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我试图重做一些具有大写字段名称和空格的表单,有数百个字段和50 +表单...我决定尝试编写一个PHP脚本来解析表单的HTML.
所以现在我有一个textarea,我将发布html进入,我想更改所有的字段名称
name="Here is a form field name"
Run Code Online (Sandbox Code Playgroud)
至
name="here_is_a_form_field_name"
Run Code Online (Sandbox Code Playgroud)
如何在一个命令中解析并更改它,以便名称标签中的所有内容都是小写的,空格将替换为下划线
我假设preg_replace有一个表达式?
谢谢!
不知道为什么这不会转换,我会假设它可能与字符串有关,但我得到np输出.
$string = '[{title : "Comp 1 Product",columns : ["Our Vehicle","Features","Their Vehicle"], items : [["dcq","adv","asdvasdv"],["sdv","sdv","sdv"]]},{title : "qwefqw",columns : ["Section 1","Features","Section 2"],items : [["qqwec","qwe","qwegqwev"]]}]';
print_r(json_decode($string), true);
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激!
php ×3
apache ×1
append ×1
bash ×1
command-line ×1
javascript ×1
jquery ×1
json ×1
linux ×1
mod-rewrite ×1
preg-replace ×1
regex ×1
urlencode ×1
wget ×1