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 6733645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:47:38+00:00 2026-05-26T10:47:38+00:00

I am building a interactive form and loading the fields according to the answer

  • 0

I am building a interactive form and loading the fields according to the answer of the user. Right now I just have two kind of objects “input radio” and “textarea”. As I am getting the value of the answers via JQuery, how can I know what object I am dealing with inside the very LAST loaded fieldset?

This is what I am trying:

$.fn.getNodeName = function() { // returns the nodeName of the first matched element, or ""
    return this[0] ? this[0].nodeName : "";
};

//var $something = $('input[type=radio]:checked:last');
var $something = $('fieldset:last').parent('nth-child(2)');

//$('#news ul li:first-child').addClass('active');

alert($something.getNodeName());

But it’s not working…
Thanks.

  • 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-26T10:47:39+00:00Added an answer on May 26, 2026 at 10:47 am

    I have extended your jQuery function to also return the type, when the element is an input element:

    $.fn.getNodeName = function() {
        var elem = this[0]; //Get the first element of the jQuery object
        if(!elem) return "";
        var name = elem.nodeName.toLowerCase();
        return name == "input" ? "input[type=" + elem.type + "]" : name;
    };
    

    Examples of possible return values:
    textarea, input[type=text], input[type=button], …

    If you prefer other output formats, just adjust the function. Another method to specify the type is by adding an extra property to the return value, such as:

    $.fn.getNodeName = function() {
        var elem = this[0]; //Get the first element of the jQuery object
        if (!elem) return "";
        var name = elem.nodeName.toLowerCase();
        if (name == "input") {
            name.type = elem.type;
        }
        return name;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
I'm building a C# client app that allows a user to communicate with one
If your building a game or interactive website and want to use the arrow
I am building a website using php+mysql. I have a registration page and its
I am building a page that will animate objects (image/shape/div) and float them around
I am building a small GUI interface and I have a QLabel that draws
I'm building a framework and want developers who build with it to have the
When building a webapp, I'd like form data / interaction to be all driven
I am in the process of building interactive front-ends to a distributed application which
I'm building an interactive movie of some sort , having more video clips that

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.