How to access html without adding it to the template
Is there any alternative for adding the below html other than in the template
<li><a href="#cc-you" class="show-fb">Me <span class="normal">(Amrinder Sandhu)</span></a>
<div style="display:none"><!-- div to hide content of fancybox overlay begins here -->
<div id="cc-you" class="pp-details"><!-- .pp-details begins here -->
</div><!-- .pp-details ends here -->
</div><!-- div to hide content of fancybox overlay ends here -->
</li>
What i want to do is i have added the "li" tag in the template and now i want the edit option to open for e开发者_开发知识库very current user onclick. How to get the id of current user without adding in the template? Can i add it to the body of the html and link somehow to the template for accessing dynamically?
While I'm not clear about your question, I can guess at an answer. I've had a similar problem before. I'm not sure why you don't want to modify the template, does it have no dynamic data in it at all? If it has dynamic data that it's rendering, why would you be opposed to put a 'data-' attribute in your <li>
? You could easily read that with jQuery, and it would provide you with a place to store metadata.
If you can't do that, but you can modify the renderer, then for each <li>
, after you have rendered it but before you have added it to the DOM, you can use the jQuery .data()
method to add extra data to the object, which can be retrieved later on an event such as click.
精彩评论