Help with class selectors-VBForums
Results 1 to 2 of 2

Thread: Help with class selectors

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002

    Help with class selectors

    I have a data driven form, and selecting certain values will open other inputs hidden in a div.

    I had this working when just one div was opened with one value, but adding multiple values has thrown me.

    I add an onclick event to the radio items, that will call a fucntion to open the div.
    <input value="0" onclick="branching(1,'==','0','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="1" onclick="branching(1,'==','1-2','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="2" onclick="branching(1,'==','1-2','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="3" onclick="branching(1,'==','3-4-5','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="4" onclick="branching(1,'==','4','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="5" onclick="branching(1,'==','5','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <input value="6" onclick="branchingClose(1,'==','1-2','ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl00_qRadio','0','0');" />
    <div id="ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl01_divQuestion" class="target1_1-2" style="display:none;"> </div>
    <div id="ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl02_divQuestion" class="target1_0" style="display:none;"> </div>
    <div id="ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl03_divQuestion" class="target1_3-4-5" style="display:none;"> </div>
    <div id="ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl04_divQuestion" class="target1_5" style="display:none;"> </div>
    <div id="ctl00_ContentPlaceHolder1_rptSegments_ctl00_rptQuestions_ctl05_divQuestion" class="target1_4" style="display:none;"> </div>
    I gave each div that was to be opened a target of class + QuestionThatOpensThis + _ + - + seperated list of answers that will open.

    So for example in above the div with class of target1_1-2 means this should display when question 1 selected value equals 1 or 2.

    Currently I have:

    $('.target' + QID + '_' + value).show('slow', function() {

    I need to modify this somehow so the value part will search for any of the supplied values rather than them all

    Any help would be great

  2. #2
    Join Date
    Jan 2005

    Re: Help with class selectors

    Using multiple classes:

    <div class="target1_1 target1_2">
    <div class="target1_3 target1_4 target1_5">

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width