简体   繁体   中英

How to push back button on top of the page

I am using a survey tool called Qualtrics and I was wondering if we can push the back button on the top left instead of bottom left, while the next button remains at the bottom

I found a code that clones the buttons. But I would only like to push the actual back button on top using JS

<script type="text/javascript">
Qualtrics.SurveyEngine.addOnReady(function() { jQuery('#HeaderContainer').after(jQuery('#Buttons').clone(1)); $('Header').insert($('Buttons')); });
</script>

Some help would be highly appreciated.

You can use the jQuery prepend() method:

The jQuery prepend() method inserts content AT THE BEGINNING of the selected HTML elements.

// otherElement will be added as the first child to someElement
$('someElement').prepend(otherElement);  

Move the back button to just after the header:

<script type="text/javascript">
Qualtrics.SurveyEngine.addOnReady(function() { 
  jQuery('#HeaderContainer').after(jQuery('#PreviousButton'));
});
</script>

However, by moving it outside the buttons div (#Buttons), you may lose css styling. Therefore, you may need to add some css to style the back button to match the next button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM