www.webdeveloper.com
Results 1 to 3 of 3

Thread: Can you submit this form?

  1. #1
    Join Date
    Apr 2005
    Posts
    210

    Can you submit this form?

    Code bellow is copied from a php pack, I change it to html file:
    Code:
    <style>
    a.button 
    {
    	margin:			10px;
    	color:			#FFF;
    	padding:		10px;
    	background:		#000;
    	border-radius:	10px;
    }
    </style>
    
    <div>
    	<a onclick="$('#myform').submit();" class="button">Save</a>
    	<a onclick="location = 'to/cancel.htm';" class="button">Cancel</a>
    </div>
    
    <form action="to/save.htm" method="post" id="myform">
    </form>
    Following line can't be changed, because it relates too many things in the php pack.
    Code:
    <a onclick="$('#myform').submit();" class="button">Save</a>
    Button 'Cancel' works fine, but button 'Save' doesn't.

    Can you make button 'Save' to submit form of 'myform'?

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    First make sure the jQuery script is present in your HTML markup for this $('#myform').submit(); to work;

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Are you warned that the code used is JQuery Framework, not native JavaScript? Do you know what a JavaScript Framework is? Do you know JavaScript, after all?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles