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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:58:09+00:00 2026-06-09T09:58:09+00:00

Why doesnt the following apply the css rules to both elements? var prevElem =

  • 0

Why doesnt the following apply the css rules to both elements?

var prevElem = $('<a href="#" class="'+ settings.prev +'" />').text('Prev');
var nextElem = $('<a href="#" class="'+ settings.next +'" />').text('Next');
container.append(prevElem, nextElem);
$(prevElem, nextElem).css('top', container.height()/2);

Its only applied to prevElem.

Please note that the dynamic elements have been added to the DOM (with their classes) so they are there.

  • 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-09T09:58:11+00:00Added an answer on June 9, 2026 at 9:58 am

    To do what you need, you must call add() method.

    var prevElem = $('<a href="#" class="'+ settings.prev +'" />').text('Prev');
    var nextElem = $('<a href="#" class="'+ settings.next +'" />').text('Next');
    
    prevElem.add(nextElem).appendTo(container).css('top', container.height()/2);
    

    Reason you can’t join arrays by providing them as parameters to jQuery, is that there is simply no such API. And there shouldn’t be because it would make it impossible to implement jQuery( selector [, context] ) which searches for elements within context.
    Check out $.add() for what you attempted to do.

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

Sidebar

Related Questions

When I apply the following code it sets the correct bar value but doesnt
How to indent the text cursor of the textbox: I used the following CSS
I got the following CSS rule in my page: a:link,a:active,a:visited{text-decoration:none;} for some reason It
Am I missing something. I have the following CSS: <style = text/css> .sidebar_qustions {padding:
The following code plays well on the simulator but the audio doesnt play on
I have the following code but it doesnt seem to work: <td align=center style=padding-bottom:52.5px>
I have the following code that when i change the drop down it doesnt
Why does the following step pass: page.has_css?(doesnt exist) when this correctly fails: page.should have_css(doesnt
This works perfectly in Firefox but doesnt work in ie i get the following
Why doesn't the following work: class CTest(tuple): def __init__(self,arg): if type(arg) is tuple: super(CTest,self).__init__((2,2))

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.