We help IT Professionals succeed at work.
Get Started

change HTML dom tree with Jquery

Jon Imms
Jon Imms asked
on
106 Views
Last Modified: 2018-05-02
I'm trying to alter the default layout for my testimonials section on my WordPress website.

At the moment, it outputs the HTML as

<div class="avia-testimonial_inner">
<div class="avia-testimonial-image"></div>
<div class="avia-testimonial-content"></div>
<div class="avia-testimonial-meta"></div>
</div>

Open in new window


What i want is

<div class="avia-testimonial_inner">
<div class="avia-testimonial-image"></div>
<div class="avia-testimonial-meta"></div>
<div class="avia-testimonial-content"></div>
</div>

Open in new window


I have 2 functions,  The first one works and has the image first, but i cannot get the meta class above the content. What am i doing wrong here?

WEBSITE

//------------------------------
// php -  Testimonial image on top
//------------------------------

function move_image_up_custom_script(){
?>
<script>
jQuery(function() {
    jQuery$('.avia-testimonial-image').prependTo($('.avia-testimonial_inner'));
     });
</script>
<?php
}
add_action('wp_footer', 'move_image_up_custom_script');

    

function add_custom_script(){
?>
<script>
jQuery(function() {
    jQuery$('.avia-testimonial-content').appendTo($('.avia-testimonial_inner'));
     });
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE