?
Solved

wrapping dynamically in a div

Posted on 2014-07-17
2
Medium Priority
?
323 Views
Last Modified: 2014-07-18
I have 2 divs next to each other.
div class=space
div class=space

how can i use jquery to add a wrapper around both div's that use selector space?
0
Comment
Question by:rivkamak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Expert Comment

by:c l
ID: 40202955
give this a shot:

$( ".space" ).wrap( "<div class='new'></div>" );

Open in new window


more info on the wrap() function - http://api.jquery.com/wrap/
0
 
LVL 2

Accepted Solution

by:
c l earned 2000 total points
ID: 40202966
sorry, i mis-read your question, you want it wrapped around BOTH divs, so use this instead:

$( ".space" ).wrapAll( "<div class='new' />");

Open in new window


more info on wrapAll() function - http://api.jquery.com/wrapall/
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question