Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3968682
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:52:20+00:00 2026-05-20T03:52:20+00:00

$(document).bind(ready, function(){ // Loop each construct tag $(‘construct’).each( alert(‘running’); function () { // Grab

  • 0
$(document).bind("ready", function(){

    // Loop each construct tag
    $('construct').each(
            alert('running');

        function ()
        {
            // Grab data
            var jC2_events = $(this).html().split('\n');
            $(this).html('');

            // Data
            var jC2_html = '';

            // Add wrapper tags
            jC2_html += '<div class="jC2_Outer">';
            jC2_html += '<div class="jC2_Toolbar">';
            jC2_html += '<a href="#" class="jC2_ToolbarA">Plain Text</a>';
            jC2_html += '<a href="#" class="jC2_ToolbarA">Help</a>';
            jC2_html += '</div>';
            jC2_html += '<div class="jC2_Container">';

            // Loop each event
            for(var jC2_looper = 0; jC2_looper < jC2_events.length; jC2_looper++)
            {           
                // Split event into components
                var jC2_components = jC2_events[jC2_looper].split(':');

                // Event wrapper
                jC2_html += '<div class="jC2_EventNum">' + (jC2_looper + 1) + '</div>'
                jC2_html += '<div class="jC2_EventWrapper">';
                    jC2_html += '<div class="jC2_EventObject">' + jC2_components[0].trim() + '</div>';
                    jC2_html += '<div class="jC2_EventBreak"></div>';
                    jC2_html += '<div class="jC2_EventDesc">' + jC2_components[1].trim() + '</div>';        
                jC2_html += '</div>';

                // Actions
                jC2_html += '<div class="jC2_ActionWrapper">';

                // Loop remaining params
                for(var jC2_looper2 = 2; jC2_looper2 < jC2_components.length; jC2_looper2++)
                {
                    var jC2_actionClass;
                    if((jC2_looper2%2) == 0){
                        jC2_actionClass = 'jC2_Odd';
                    }else{
                        jC2_actionClass = 'jC2_Even';
                    }

                    jC2_html += '<div class="jC2_ActionLeft"></div>';
                    jC2_html += '<div class="jC2_ActionDesc ' + jC2_actionClass + '">' + jC2_components[jC2_looper2].trim() + '</div>';
                    jC2_html += '<div class="jC2_Clear"></div>';
                }               

                jC2_html += '</div><div class="jC2_Clear"></div>';
            }

            // End wrappers
            jC2_html += '</div>';
            jC2_html += '<div class="jC2_FooterInfo"><div class="jC2_Scirra"><a class="jC2_AS" href="http://www.scirra.com">Scirra.com</a> - Software in Motion</div>Generated with <a class="jC2_AF" href="http://www.scirra.com">JConstruct 1.0</a></div>';
            jC2_html += '</div>';
            $(this).html(jC2_html);
        }
    );

});

And my HTML page:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.<br /><br />

<construct>
System:Every tick:Set width to Y-100:Set angle to Atan(Self.X-Mouse.X):Finish it
Sprite:On event:Do this:Do that:Do something else
Clock:Ticks and chimes:Do something:Do it again!:Add one
</construct>

<br /><br />When an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

I’m just trying to loop every tag and render it’s data contents as a nicely formatted HTML but am having trouble parsing the data into individual lines, and having trouble because this loop appears to be running twice when I put an alert in it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:52:21+00:00Added an answer on May 20, 2026 at 3:52 am
    // Loop each construct tag
    $('construct').each(
            alert('running');
    
        function ()
        {
    

    Should read:

    // Loop each construct tag
    $('construct').each(
        function ()
        {
            alert('running');
    

    It’s currently invalid and may cause unexpected and inconsistent behaviour in different browsers.

    See http://jsfiddle.net/uBFAK/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$(document).ready( function() { $('input[id^=btnRemoveCategory]').bind( 'click', function(){ if($('input[id^=chkIsBottom_:checked]')) alert('YES YES YES!!!!'); else alert('No NO no!!!!!');
$(top.document).ready(function () { $(*).click(processAction); function processAction(e){ var clicked = e.target; e.stopPropagation(); alert(clicked.tagName); e.stopPropagation(); switch(clicked.tagName)
$(document).ready(function() { $('a#fav').bind('click', addFav(<?php echo $showUP[uID]; ?>)); }); was before $(document).ready(function() { $('a#fav').bind('click', addFav);
$(document).ready(function() { $('a#fav').bind('click', function() { addFav(<?php echo $showUP[uID]; ?>); }); }); function addFav(id){ $.ajax({
$(document).ready(function() { $('a#fav').bind('click', function() { addFav(<?php echo $showUP[uID]; ?>); }); }); I need to
$(document).ready(function(){ WinSize = $(window).width(); var currentPosition = 0; var slideWidth = WinSize; $(function(){ $(window).resize(function(){
$(document).ready(function(){ WinSize = $(window).width(); var currentPosition = 0; var slideWidth = WinSize; $(function(){ $(window).resize(function(){
$(document).ready(function() { $(span.link).mouseover(function(e){ $(this.children).css(display,inline); }); }); I'm not a javascript expert, but I've cobbled
$(document).ready(function(){ $(.txtDate).datepicker({ showOn: both, buttonImage: library/ui/datepicker/img/calendar2.gif, dateFormat: yy/mm/dd, buttonImageOnly: true }); //added this checkbox
I have table which class is forum . My jquery code: <script type=text/javascript> $(document).ready(function()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.