Javascript fadeln脚本工作不正常
我的脚本有问题。我要做的是获取任何标记的css idJavascript fadeln脚本工作不正常,javascript,php,jquery,html,laravel,Javascript,Php,Jquery,Html,Laravel,我的脚本有问题。我要做的是获取任何标记的css id,并在脚本中告诉他:x之后删除标记 Lorem ipsum dolor sit amet,康涅狄格州 ' : ' Lorem ipsum dolor sit amet,康涅狄格州 '; $counter++; } 我用的是拉威尔的框架 图像: -这一类别运作良好 -此分类不起作用您正在尝试循环字符。此for循环将运行0次。尝试使用此javascript。您的循环还希望在9-22之间迭代。我猜ID不仅仅在9-22之间。因此,对所有适用的d
,并在脚本中告诉他:x之后删除标记
Lorem ipsum dolor sit amet,康涅狄格州
' : '
Lorem ipsum dolor sit amet,康涅狄格州
';
$counter++;
}
我用的是拉威尔的框架
图像:
-这一类别运作良好
-此分类不起作用您正在尝试循环字符。此for循环将运行0次。尝试使用此javascript。您的循环还希望在9-22之间迭代。我猜ID不仅仅在9-22之间。因此,对所有适用的div>p执行此操作
jQuery(函数($)
{
$('div.span12>p').find('a[href]').attr('href','#lock');
$('div.span12>p')。查找('i.cercale2')。替换为(“”)
});
请显示您的实际渲染输出(HTML)。这个问题与PHP或您的服务器端代码无关。您的意思是什么?在将代码打印到html之后?@idan003在浏览器jQuery中呈现的代码(函数($){var i='';for(i='9';我谁能帮我?不好,在我执行循环之后,我需要执行然后关闭它。同样,代码运行良好,但在1类中无效,而在2类中有效。所以我不知道为什么。不在1类中有效,在2类中无效。
jQuery(function ($) {
var i = '';
for (i = '9'; i <= '22'; i++) {
$('div > p.lessonsrow-' + i).find('a[href]').attr('href', '#lock');
$('div > p.lessonsrow-' + i).find('i.cercale2').replaceWith('<i class="cercale2 fa fa-lock fa-1x"></i>')
}
});
foreach ($lessonsid as $row) {
$html .= $counter % 2 == 0 ? '
<div class="span12 bar_lessons">
<p class="lessonsrow-' . $row->id . '">
<i class="cercale2 glyphicon glyphicon-play fa-1x"></i>
<a href="' . url() . '/gui/' . $url . '/' . Request::segment(3) . '/lessons/' . $row->courses_id . '/vod/' . $row->id . '">' . trans('lessons.' . $row->name) . '</a>
</p>
<p class="text">Lorem ipsum dolor sit amet, con</p>
</div>' : '
<div class="span12 bar_lessons2">
<p class="lessonsrow-' . $row->id . '">
<i class="cercale2 glyphicon glyphicon-play fa-1x"></i>
<a href="' . url() . '/gui/' . $url . '/' . Request::segment(3) . '/lessons/' . $row->courses_id . '/vod/' . $row->id . '">' . trans('lessons.' . $row->name) . '</a>
</p>
<p class="text">Lorem ipsum dolor sit amet, con</p>
</div>';
$counter++;
}
jQuery(function ($)
{
$('div.span12 > p').find('a[href]').attr('href', '#lock');
$('div.span12 > p').find('i.cercale2').replaceWith('<i class="cercale2 fa fa-lock fa-1x"></i>')
});