call the onclick event inside the input type=submit

This is tricky question but it would be really great If you provide me the solution

I have <input type="submit" onClick="call(parameter)">. Is thathandle this function from external Jquery function.

Problem is I am not able to click this button since it has already onlcik functionality. Is there any way to do this?
gaurihAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kiran SonawaneProject LeadCommented:
Look at below code

button click event is called when text changed in textbox

Demo http://jsfiddle.net/LRYaq/
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
  <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<script>
$(document).ready(function(){
 
 $("#txt").keyup(function(){
   $("#btn").click();
 });

 $("#btn").click(function(){
   alert("button is click event fired");
 });
 
 
});
</script>

</head>

<body>

<input type="button" id="btn" value="button click">

<input type="text" id="txt">

</body>
</html>

Open in new window

0
Gurvinder Pal SinghCommented:
check this one on submit button
http://jsfiddle.net/gurvinder372/jseF4/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gaurihAuthor Commented:
in the above code snippet, if the button has onclick event as below
<input type="button" id="btn" value="button click" onclick="submitForm()">

Is that possible to trigger the click from the script and as well as the onclick event?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Kiran SonawaneProject LeadCommented:
Yes it is possible.

Look at below code. First check function is called then click event is fired.


<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
  <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<script>
$(document).ready(function(){
 
 $("#txt").keyup(function(){
   $("#btn").click();
 });

 $("#btn").click(function(){
   alert("button is click event fired");
 });
 
 
});

function check()
{
  alert("DD");
}
</script>

</head>

<body>

<input type="button" id="btn" value="button click" onclick="check()">

<input type="text" id="txt">

</body>
</html>

Open in new window

0
Kiran SonawaneProject LeadCommented:
OR

If you want to call submitForm() method you can call it within jquery click event as well like below

 $("#btn").click(function(){
   alert("button is click event fired");
  submitForm();
 });

So that click event is fired as well as submitForm is called.
0
gaurihAuthor Commented:
Hi guruvinder,
I tried your sample code, onclick event is removed but alert is not coming for me included in .bind function. am I missing something?
0
Gurvinder Pal SinghCommented:
please show that code to me

are you placing the code in document.ready or outside?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JScript

From novice to tech pro — start learning today.