Hi all!
I've received a complex task that I'm not able to answer. Hope you guys can help me!
Task:
You have a hypothesis that changing the order of the "Add to Wish List" and "Book Now" elements will increase conversions. Write the JavaScript needed to swap the 2 elements for every trip listed on the page when the "Change Order" button is clicked.
Hint: You may want to write an each function to have this work properly. Make sure that you only have 1 "Add to Wish List" element and 1 "Book Now" element under each trip.
HTML document:
-
<h1>This is a Header</h1>
-
<button id="changeOrder" type="button">Change Order</button>
-
<div id="Paris">
-
<h2>Book a trip to Paris</h2>
-
<div id="Paris_wish" class="wish_list">Add to Wish List</div>
-
<div id="Paris_book" class="book_now">Book Now!</div>
-
</div>
-
<div id="London">
-
<h2>Book a trip to London</h2>
-
<div id="London_wish" class="wish_list">Add to Wish List</div>
-
<div id="London_book" class="book_now">Book Now!</div>
-
</div>
-
-
$(function() {
-
$("#changeOrder").click(function() {
-
// ADD YOUR CODE HERE
-
-
});
-
});
Thanks in advanced!
Jonathan