Jquery - 根据某些条件

时间:2015-08-14 08:45:02

标签: jquery html

我正在尝试在<footer>标记内的<blockquote>标记中添加一些文字,但这不起作用。我正在使用Bootstrap和jQuery。以下是我到目前为止所尝试的内容:

HTML:

<h5>
<div class="text-green"> Done by User / Ticket Status: Booked</div>
</h5>
<blockquote id="activity-detail">Details activities</blockquote>

的jQuery / JavaScript的:

<script>
.....
.....
// the note is a text value is fetched from json and console.log is logging it properly.
// Assume that note = 'This is the note text'.
if(note != ""){
                $('#activity-detail').append("<footer>" + note +"</footer>");
            }
......
......
</script>

预期结果

假设音符不是"" (blank)

<h5>
<div class="text-green"> Done by User / Ticket Status: Booked</div>
</h5>
<blockquote id="activity-detail">Details activities
  <footer>This is the note text. </footer>
</blockquote>

我在这里缺少什么?

0 个答案:

没有答案