1 Replies - 972 Views - Last Post: 06 November 2009 - 12:17 PM

#1 dreamincodeFTW  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-November 09

How do i get an alert to stop a page from going on

Posted 06 November 2009 - 08:45 AM

i have this button, i would like this button on click to pop up an alert "are you sure". If yes continue to the url that in the function, if no stay on the page.


<input type="button" id="addlesson" value="Add Lesson!" onclick="inputter(document.getElementById('testid').value)" />



here is the inputter function

function inputter(element){
	
			parent.location='studentaddlesson.php?option=&s_id=' + escape(element);
		
		}
	
			$(document).ready(function() {
			
		 $('#testid').keyup(function(e) {
	   
		if(!e) e = window.event;
 
		if(e.keyCode == 13) {
			inputter(document.getElementById('testid').value);
		}
		 }
		 
			)
		} )



So my question is, how do i tie this jquery alert to the button to stop the action. Right now it pops up but does not stop the page from going to the url
$(document).ready( function() {
				
				$("#addlesson").click( function() {
					jConfirm('Can you confirm this?', 'Confirmation Dialog');
				
				});
				});



Is This A Good Question/Topic? 0
  • +

Replies To: How do i get an alert to stop a page from going on

#2 touch  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 23
  • Joined: 20-October 09

Re: How do i get an alert to stop a page from going on

Posted 06 November 2009 - 12:17 PM

This line:

 parent.location='studentaddlesson.php?option=&s_id=' + escape(element); 


Needs to go in your confirmation box function
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1