In my form there are two anchor tags Add and Clear having same class called button. What I am trying is submit the form data to another page(post) using ajax & clear is for clearing the data using javascript.The problem is that as both buttons having the class the same function(submit ) is called for both button.
css is look like:
JS script
form code
What methods I tried?
1. changed the changed the line to check whether the inline reset call is triggering or not. but no success.
2.Added dummy button of input type button. This time inline onclick event is triggered
css is look like:
Code:
form.addwords .button
{
font-weight: bold;
color: #ffffff;
cursor: pointer;
font-size: 15px;
height: 43px;
width: 107px;
}
form.addwords #addwordsbutton
{background:url("../img/leftbtn.png") no-repeat 0 0;}
form.addwords #clearwordsbutton
{background:url("../img/rightbtn.png") no-repeat 0 0;}
Code:
jQuery('.button').live('click', function(event) {
var da=$('#addwords').attr('value');
alert(da);
$.ajax({
type: "POST",
url: "addmulti.php",
data: "knw=" + da,
success: function(data){
$('#results').html(data);
},
error: function(){
alert('Error');
}
});
});//end of .button click
Code:
<a href='#' class='button' id='addwordsbutton'><span class="try">Add</span></a> <a href='#' class='button' id='clearwordsbutton' onClick='this.form.reset();'><span class="try">Clear</span></a> <input id="myButton" type="button" value="To check" onclick="this.form.reset();">
1. changed the changed the line to check whether the inline reset call is triggering or not. but no success.
Code:
jQuery('.button').live('click', function(event)
to
jQuery('.button[B]s[/B]').live('click', function(event)
Comment