Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Ajax调用的html文件上应用脚本_Javascript_Jquery_Html_Ajax - Fatal编程技术网

Javascript 在Ajax调用的html文件上应用脚本

Javascript 在Ajax调用的html文件上应用脚本,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,一切都在标题中 我创建了一个在元素范围内运行的代码: (函数($){ $('.range')。每个(函数(){ var范围=$(此); range.on('input',function(){ range.next().text($(this.val()); }) .next().text(range.val()); }); })(jQuery); 我希望它也能在Ajax调用的相同元素上工作 $('.ajax global')。在('click',function()上{ var param=

一切都在标题中

我创建了一个在元素范围内运行的代码:

(函数($){
$('.range')。每个(函数(){
var范围=$(此);
range.on('input',function(){
range.next().text($(this.val());
})
.next().text(range.val());
});
})(jQuery);
我希望它也能在Ajax调用的相同元素上工作

$('.ajax global')。在('click',function()上{
var param=$(this.attr('id');
$('.ajax window').load('./ajax/'+param+'.php');
});
下面是这些标记范围的一个实际示例:

如果我通过Ajax调用相同的html代码,javascript不适用于后者。(按下“欢迎堆叠溢出”按钮)

如何进行?这是一个我无法解决的困境,而且在一段时间内

编辑:

我记得有一个有用的函数:$.getScript(),我就快到了:

它是有效的。。。除了调用的文件被重新应用于整个文档之外,我只想限制通过Ajax调用的新html元素(以限制bug)。

您的请求返回html而不使用任何脚本。它被正确地插入到DOM中

h2 class="h3">Welcome Stackoverflow !</h2>
<p class="message-info">The following code - called via Ajax - is not functional for the time necessary because the script is not associated. The imput type ranks should be able to display a number in the top right of the slide (<a href="./#index-ranges">see a working example on this page</a>).</p>
<form>
  <fieldset>
    <input type="range" name="a" min="0" max="100" step="1" value="50" class="range"/>
    <output>--</output>
  </fieldset>
</form>
欢迎光临!

以下通过Ajax调用的代码在必要的时间内不起作用,因为脚本没有关联。输入类型列组应该能够在幻灯片的右上角显示一个数字()

--
您希望执行哪一个脚本?

很抱歉,您的问题根本不清楚。请在问题中包含任何相关代码。好的,我更新我的帖子。Thank.jQuery
.delegate
方法可能会有帮助,确切地说,这是我想做的一个委派,但我不知道如何做…我以Range标记为例回答我的问题,但实际上我可能能够应用网页调用的所有脚本javascript文件。我可能已经找到了一条轨迹。看到我原来的帖子更新。。。
h2 class="h3">Welcome Stackoverflow !</h2>
<p class="message-info">The following code - called via Ajax - is not functional for the time necessary because the script is not associated. The imput type ranks should be able to display a number in the top right of the slide (<a href="./#index-ranges">see a working example on this page</a>).</p>
<form>
  <fieldset>
    <input type="range" name="a" min="0" max="100" step="1" value="50" class="range"/>
    <output>--</output>
  </fieldset>
</form>