我有以下代码:
<a href="#x_table" {{ $service->specie == 'x' ? 'onload="click()"' : '' }}
class="{{ $service->specie == 'x' ? 'active' : '' }}"
id="xEditNavigator">PlaceHolder</a>
我有{{ $service->specie == 'x' ? 'onload="click()"' : '' }}
主播。
它应该工作,但是不行,还有其他办法吗?
在您的HTML中:
<a href="#x_table" class="{{ $service->specie == 'x' ? 'active' : '' }}"
id="xEditNavigator">PlaceHolder</a>
然后,在 <body>
<script>
@if($service->specie == 'x')
document.getElementById('xEditNavigator').click();
@endif
</script>
另外,如果您使用的是jQuery:
<script>
@if($service->specie == 'x')
$(document).ready(function(){
$('#xEditNavigator').click()
})
@endif
</script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句