Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello. I have a problem regarding drop down, changing to the button for the looping pagination. Control by javascript. The javascript cannot get the value from the looping button. Do you have idea how to solve this problem or any suggestion?

Thank You.

What I have tried:

<?php 
	for($i=1; $i<= $pages; $i++){
		echo '<button id="selectPage" value="'.$i.'" >'.$i.'</button>';
	}
?>
<script>

$('#selectPage').change(function(){
	$('.spin-loader').show();
	var lookfor = $('#jobsrchform1').serialize() + '&page='+$('#selectPage').val();
	<?php if($login_user == 'GUEST') {?> var url = 'search_postings/content_01.php'; <?php } else { ?>
	var url = '../search_postings/content_01.php';
	<?php }?>
	$.post(url,lookfor,function(data){
		$('.spin-loader').hide();
		$('#mainContainer').html(data);
	});
	return false;
});
</script>
Posted
Comments
SrikantSahu 29-Jul-17 3:55am    
try in console once(F12). see if $('#selectPage').val() gives any values.
Ideally when you are forming those buttons they all will have same ids.
And the change event handler, I am not sure.. did you think about a Select Item with a different Id?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900