alert jquery conformation...

Discussion in 'jQuery' started by DigitalFTW, Nov 5, 2009.

  1. #1
    how can i put a alert on this

    
    
    
    <input type="button" id="addlesson" value="Add Lesson!" onClick="inputter(document.getElementById('testid').value)" /> 
    
    
    
    Code (markup):
    the onclick right now sends a value over the url
    i want the alert to stop that and ask if they are sure they want to do that yes and continue no just stay there.


    i have the jquery working but it doesn't stop the page from going on...
    
    
    $(document).ready( function() {
    				
    				$("#addlesson").click( function() {
    					jConfirm('Can you confirm this?', 'Confirmation Dialog');
    				
    				});
    				});
    				
    
    Code (markup):
    how can i get the alert to tie into if the page action ?
     
    DigitalFTW, Nov 5, 2009 IP
  2. DigitalFTW

    DigitalFTW Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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)" />
    
    
    Code (markup):
    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);
            }
             }
             
                )
            } )
    
    Code (markup):
    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');
    				
    				});
    				});
    
    Code (markup):
     
    DigitalFTW, Nov 6, 2009 IP