0
有人可以解釋什麼?操作符表示在以下行中 - 是否意味着OR。如果這意味着或一個人如何解釋線,因爲它沒有任何意義:jquery語法和正則表達式運算符
d = a.attr("data-template") || "<% remainingChars %> characters left"
下面是從它採取
$("[maxlength]").each(function (ind, elem) {
var b = $(this),
a = b.parent(".form-group").find(".caption"),
d = a.attr("data-template") || "<% remainingChars %> characters left";
代碼和HTML:
<div class="form-group">
<small class="caption" data-template="<% remainingChars %> characters left">
150 characters left
</small>
<input type="text">
</div>
第二個替換以下正則表達式的部分是做什麼的,{{maxCount}}是什麼意思?
c = d.replace(/<% remainingChars %>/gi, g()).replace(/{{maxCount}}/gi, j);