On click of an element, change properties of another element

Hi guys,

In a simple piece of code like this:

<div id="main">
<div id="one"></div>
<div id="two"></div>
</div>

<div id="change"></div>

script:

	$(holdername).on("click", ".change", function() {	
 $(this).prependTo("#main");
			
		});

This does what I expect, it moves the change div up, but what I really want to happen is, on click of the change div, I want div two to move above div one. anyway I can do this? (Just fyi I can’t just hyperlink the div two div because its already hyperlinked for other reasons)

You can do it in the same way:

$(holdername).on("click", ".change", function() {	
  $("#two").prependTo("#main");
});

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.