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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:39:35+00:00 2026-06-04T10:39:35+00:00

I am dynamically creating spans appended to new inputs. If the title input has

  • 0

I am dynamically creating spans appended to new inputs. If the title input has certain children who are visible I want the new input children to also have those classes visible.

I want something like:

var visibleClass = $('#titlediv').children().is(':visible').each('.class');

$('#newinput').children('span').hasClass('.' + visibleClass).show();

Here is an example of code from the function that creates the new input and div. In this example ‘.catsadd’ refers to the variable all images which all have the class catsadd and also have their own unique class:

var item = $('<input />');

item.attr({'type':'text', 'size': '33px' , 'class':'inputItem' , 'id':'item' + nextItemId })

.appendTo('#itemDiv' + nextItemId);



    //Create Span for category selections

$('<span />').attr({'class':'dynamiccat' , 'id':'categorydiv' + nextItemId})

.prependTo('#itemDiv' + nextItemId);

$('#categorydiv' + nextItemId).append(allimages);

$('.dynamiccat').hide();

$('.catsadd').hide();

Thanks in advance for any help!

  • 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-06-04T10:39:36+00:00Added an answer on June 4, 2026 at 10:39 am

    If I got you right, you want to get all the classes of the visible elements:

    var visibleClasses = $('#titlediv :visible[class]').map(function(){
        return this.className.split(\s);
    }).get();
    

    Direct children:

    var visibleClasses = $('#titlediv > :visible[class]').map(function(){
        return this.className.split(\s);
    }).get();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So if I'm dynamically creating textviews in a foreach loop and want to assign
After dynamically creating an element with this: $('#btnAddBanner').click(function () { var uid = new
I am dynamically creating textboxes using document.createElement('input') and adding a break between them using
I am dynamically creating a NotifyIcon using the code below: Dim traysystem As New
I am dynamically creating an Item template in a Gridview. TemplateColumn BtnTmpField = new
I am dynamically creating a table which I want to have clickable rows. When
I am dynamically creating some classes and I want them to have different docstrings.
I am dynamically creating inputs when the users double clicks an element in a
I´m dynamically creating an instance of a class with reflection and this works fine,
i am dynamically creating sql query for inserting multiple records in one hit.Suppose no

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.