【发布时间】:2015-04-04 03:31:37
【问题描述】:
我的脚本有问题。我所做的是获取任何标签<p> 的css id 并在脚本中告诉他:在x 之后删除标签<a>。它适用于 Y 类,但在 X 类中它不起作用,而且我没有收到任何错误。
我的代码:
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>')
}
});
标签 HTML:
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++;
}
我使用 laravel 框架。
图片:
http://prntscr.com/60ystp - 这个类别运行良好
http://prntscr.com/60ysna - 此类别无效
【问题讨论】:
-
请显示您实际渲染的输出 (HTML)。这个问题与 PHP 或您的服务器端代码无关。
-
你是什么意思?之后是将代码打印到 html 吗?
-
@idan003 在浏览器中呈现的代码
-
-
谁能帮我解决这个问题?
标签: javascript php jquery html laravel