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

  • SEARCH
  • Home
  • 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 6763683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:30:20+00:00 2026-05-26T14:30:20+00:00

I have an example I made with JQuery 1.4 here is the html: <!DOCTYPE

  • 0

I have an example I made with JQuery 1.4

here is the html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Formularseite</title>
    <link href="style3.css" rel="stylesheet" type="text/css" media="all" />
    <script type="text/javascript" src="js/jquery-1.7.js" ></script>
    <script type="text/javascript" src="js/meineScripts.js" ></script>
  </head>
  <body>
<?php
if (isset($_POST['senden']))
{

}
else { ?>
    <form action="formular.php" method="POST" enctype="Multipart/Formdata"> 
      <fieldset>
        <legend>Demo1 JQuery</legend>
        <label for="auswahl1">Auswahl treffen:</label>
        <input class="grouptrigger" type="checkbox" id="auswahl1" name="daten[0]" value="true"/>
        <br/>
        <div class="auswahl1 hide_on_start">
          <label for="eineZeile">Text:</label>
          <input type="text" id="eineZeile" name="daten[1]" value=""/>
        </div>
        <input class="grouptrigger" type="radio" id="auswahl2a" name="daten[2]" value="1" />
        <label for="auswahl2a">Option 1</label>
        <input class="grouptrigger" type="radio" id="auswahl2b" name="daten[2]" value="2" />
        <label for="auswahl2b">Option 2</label>
        <input class="grouptrigger" type="radio" id="auswahl2c" name="daten[2]" value="3" />
        <label for="auswahl2c">Option 3</label>
        <div class="hide_on_start auswahl2a">
          <label for="eineZeile2a">Text Opt1:</label>
          <input type="text" id="eineZeile2a" name="daten[3]" value=""/>
        </div>
        <div class="hide_on_start auswahl2b">
          <label for="eineZeile2b">Text Opt2:</label>
          <input type="text" id="eineZeile2b" name="daten[4]" value=""/>
        </div>
        <div class="hide_on_start auswahl2c">
          <label for="eineZeile2c">Text Opt3:</label>
          <input type="text" id="eineZeile2c" name="daten[5]" value=""/>
        </div>
        <br/>
        <label for="auswahl3">Auswahl treffen:</label>
        <select name="daten[6]" id="auswahl3" class="grouptrigger">
          <option value="0" >Bitte wählen:</option>
          <option value="1" id="auswahl3a" >Eintrag</option>
          <option value="2" id="auswahl3b" >anderer Eintrag</option>
          <option value="3" id="auswahl3c" >weiterer Eintrag</option>
        </select>
        <div class="hide_on_start auswahl3a">
          <label for="eineZeile3a">Text 1:</label>
          <input type="text" id="eineZeile3a" name="daten[7]" value=""/>
        </div>
        <div class="hide_on_start auswahl3b">
          <label for="eineZeile3b">Text 2:</label>
          <input type="text" id="eineZeile3b" name="daten[8]" value=""/>
        </div>
        <div class="hide_on_start auswahl3c">
          <label for="eineZeile3c">Text 3:</label>
          <input type="text" id="eineZeile3c" name=""/>
        </div>        
      </fieldset>
      <p class="font20px"><input type="submit" name="senden" value="Abschicken"></p>
    </form>
<?php } ?>
  </body></html>

here is the js:

// Add RegExp Filter
// From: http://james.padolsey.com/javascript/regex-selector-for-jquery/
$.expr[':'].regex = function(elem, index, match) {
  var matchParams = match[3].split(','),
    validLabels = /^(data|css):/,
    attr = {
      method: matchParams[0].match(validLabels) ? 
            matchParams[0].split(':')[0] : 'attr',
      property: matchParams.shift().replace(validLabels,'')
    },
    regexFlags = 'ig',
    regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
  return regex.test(jQuery(elem)[attr.method](attr.property));
}

$(document).ready(function() {
  $('body').addClass('js');

  // Toggeling groups
  $(".grouptrigger").change( function() 
  {
    var toCheck = ":not(:checked)";
    if ($(this).hasClass('inverse'))
      toCheck = ":checked";
    var hideGroup = "."+this.id;
    // for radio buttons
    alert (" "+$(this).attr('type')+' '+this.id);
    if ($(this).attr('type') == "radio")
    {
      var hideGroupParent=hideGroup.substr(0,hideGroup.length-1);
      try { $("div:regex(class, .*"+hideGroupParent+".*)").hide(0); } catch (err) {}
      if ($("#" + this.id).is(":checked")) 
        $(hideGroup).show(0);
    }
    // for select lists
    else if ($(this).attr('type') == "select-one")
    {
      var hideGroupParent=this.id;
      hideGroup = '.'+$('#' + this.id + ' :selected').attr('id');
      try { $("div:regex(class, .*"+hideGroupParent+".*)").hide(0); } catch (err) {}
      $(hideGroup).show(0);
    }
    else
    // for checkboxes
    {
      if ($("#" + this.id).is(toCheck)) 
        try { $(hideGroup).hide(100); } catch (err) {}
      else
        $(hideGroup).show(100);
    }
  });
  $(".grouptrigger").change();
});

The problem with JQuery 1.7 is that

alert (" "+$(this).attr('type')+' '+this.id);

yields ‘undefined’ for the select instead of ‘select-one’ as was the case with JQuery 1.4. Is that a bug or is there another way of detecting the select element?

  • 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-26T14:30:21+00:00Added an answer on May 26, 2026 at 2:30 pm

    on the jquery site you find this information

    As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() should not be used on plain objects, arrays, the window, or the document. To retrieve and change DOM properties, use the .prop() method.

    so use prop('type')

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

Sidebar

Related Questions

Live example here: http://timkjaerlange.com/foobar/stack-stuff/august-18-2010/test.html I want to animate addClass and removeClass on this interface
I have a page that uses the JQuery Listnav plugin ( http://www.ihwy.com/labs/jquery-listnav-plugin.aspx ). The
I have an example class containing two data points: public enum Sort { First,
I need your help. I have made a really clean and simple example to
I am using Easy Slider 1.7 - jQuery plugin and have made many modifications.
I have a menu made with HTML, using a simple UL with lots of
Using jQuery validation plugin but it has no CSV validation. I have made an
Hoping someone can give me a hand here.... I have the DataTables jquery plugin
Need something simulat jcrop plucgin (link to example is here: http://publikz.com/one-more-task-rounded-selection-in-jquery/ ) but with
Possible Duplicate: multiple upload images on c#/jquery hey guys! Yesterday i made here a

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.