Solved

wrapping dynamically in a div

Posted on 2014-07-17
2
306 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SharePoint and CAML query help 4 26
CSS (jquiry mobile) question 3 34
close window in firefox 3 37
Can't see json data in ajax call to Highcharts 2 26
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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

732 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