Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript jquery verification logic
    primarykey
    data
    text
    <p>I have a logic question today. I have a form based on .load, which is working just fine. What I'm a bit stuck on is loading a title based on the position of a loaded form area. My "next" button works fine because i have verification for each area i load. for example</p> <pre><code>$('#next').click(function() { if(question_pos==0) { question_pos+=1; $("#title_area").load("bl_forms.jsp #area_title1"); showContent(question_pos,"right"); return true; } }); </code></pre> <p>Now what I need is the back button to load the right title based on the position. Here is my back button,</p> <pre><code>$('#back').click(function() { if(question_pos&gt;=2 &amp;&amp; question_pos&lt;=25) { question_pos-=1; showContent(question_pos,"left"); return true; } }); </code></pre> <p>I need title 1 to be loaded from area pos 1-2, title 2 from area pos 3-7, title 4 from area pos 4-6, and so on. All I need is an example of how to add in the title load to back function. In case confusion arizes, the</p> <pre><code>if(question_pos&gt;=2 &amp;&amp; question_pos&lt;=25) { </code></pre> <p>Is there only to prevent the back button from changing the pos before pos 2 and afer pos 25.</p> <pre><code>/*New edit*/ </code></pre> <p>What about adding a callback? something like</p> <pre><code>$('#back').click(function(){ if(question_pos&gt;=2 &amp;&amp; question_pos&lt;=2){ question_pos-=1; showContent(question_pos,"left"); ('#back').callback(function(){ if(question_pos&lt;=1 &amp;&amp; question_pos&gt;=2){ $("#title_area").load("bl_forms.jsp #area_title1"); }else if (question_pos&lt;=3 &amp;&amp; question_pos&gt;=7){ $("#title_area").load("bl_forms.jsp #area_title2"); }else if (question_pos&lt;=8 &amp;&amp; question_pos&gt;=10){ $("#title_area").load("bl_forms.jsp #area_title4"); }else if (question_pos&lt;=11 &amp;&amp; question_pos&gt;=12){ $("#title_area").load("bl_forms.jsp #area_title4"); }else if (question_pos==13 || question_pos&lt;=16){ $("#title_area").load("bl_forms.jsp #area_title4"); }else if (question_pos==17 || question_pos&lt;=19){ $("#title_area").load("bl_forms.jsp #area_title4"); }else if (question_pos==20 || question_pos&lt;=21){ $("#title_area").load("bl_forms.jsp #area_title4"); }else if (question_pos==22 || question_pos&lt;=25){ $("#title_area").load("bl_forms.jsp #area_title4"); } } }); </code></pre> <p>Maybe something that allows a bunch of extra if statements, or somethins that allows an </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload