如果值未定义,我要隐藏一个url按钮,我通过了attibute,然后添加到了一个类中
<script="text/javascript">
.........
j('.url').attr('href',ContextPath + home);
</script>
和按钮的定义类似
<a href="#header" class="btn btn-black txt-white url" title="button">
<i class="fa fa-user fa-fw" aria-hidden="true"></i>
</a>
如果网址未定义,我想隐藏按钮。我写了这个jQuery代码,但是没有用。
<script type="text/javascript">
jQuery (document).ready(function($) {
$('url').children('a').each(function() {
if(($(this).attr('url')=='undefined'))
$(this).hide();
})
})
</script>
任何想法?