English 中文(简体)
j 模板是可能的?
原标题:Using jquery within jquery Templates, is this possible?

如果与 j格模板进行核对,我想进行:

舱位模板

<script id="CardWallItem" type="text/x-jquery-tmpl">
    <div id="lc${ProductId}" class="card">
        <input class="ItemId" type="hidden" value="${CardId}"/>
        <a href="" class="oCloseButton" onclick="return $$.laneItems.deleteLane(this);">x</a>
        if($.parent().find( .ItemId ).val() == ${EntityId}){
        <p class="text" onclick="return $$.laneItems.editCard(this);">${Desc}</p> 
        <div class="edit bg" style="display:none;">
            <input class="editval" type="text" maxlength="20" />
            <a class="button" href="" onclick="return $$.laneItems.saveTitle(this);">Save</a> 
        </div>
        }
    </div>
    <br /><br />
</script>

并且正如你能够看到:

if($.parent().find( .ItemId ).val() == ${EntityId}){
            <p class="text" onclick="return $$.laneItems.editCard(this);">${Desc}</p> 
            <div class="edit bg" style="display:none;">
                <input class="editval" type="text" maxlength="20" />
                <a class="button" href="" onclick="return $$.laneItems.saveTitle(this);">Save</a> 
            </div>
            }

这是因为,如果在页面上报,则该数字是全印的。 因此,没有人告诉我,我应该做些什么?

最佳回答

质量模板本身是任何超文本标记,还有一套模板标记,使一些非常丰富的假想能够创建数据驱动的电子数据。 j岩模板中支持的一组标记是:

- ${...}: Evaluate fields or expression
- {{each ...}}...{{/each}}: Iterate without creating template items
- {{if ...}}...{{else ...}}...{{/if}}: Conditional sections
- {{html ...}}: Insert markup from data
- {{tmpl ...}}: Composition, as template items
- {{wrap ...}}...{{/wrap}}: Composition, plus incorporation of wrapped HTML

详情和例请访问rel=“nofollow”>here

问题回答

The syntax of conditionals in jquery templates is different:

{{if CONDITION}}

{{else}}

{{/if}}

文件





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签