connect jquery to particular button

Posted by Klbaiju under jQuery on 4/8/2010 | Views : 1768 | Status : [Member] | Replies : 2
Hi,
iam using jquery validation.jquery validation is working. but i have 3 buttons. every button is firing.i want to set jquery validation to a particular button.
how it is possible.

Regards
KL BAIJU




Responses

Posted by: Vuyiswamb on: 4/8/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
every button will fire only if you have wired the jscript to them, show us the definition of those buttons

Thank you for posting at Dotnetfunda
[Administrator]

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenmanam on: 4/12/2010 [Member] Starter

Up
0
Down
hear i will use radio button once
check it.
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() {
alert("Submitted!");
}
});

$.metadata.setType("attr", "validate");

$(document).ready(function() {
$("#quiz_form").validate();
});
</script>

</head>
<body>

<div id="main">

<form class="cmxform" id="quiz_form" method="get" action="">
<fieldset>
<fieldset>
<label for="answer1">
<input type="radio" id="answer1" value="1"
name="answers"
validate="required:true" />
Answer 1
</label>
<label for="answer2">
<input type="radio" id="answer2" value="2"
name="answers" />
Answer 2
</label>
<label for="answer3">
<input type="radio" id="answer3" value="3"
name="answers" />
Answer 3
</label>
<label for="answer4">
<input type="radio" id="answer4" value="4"
name="answers" />
Answer 4
</label>
<label for="answers" class="error">Please select an
answer.</label>
</fieldset>
<input class="submit" type="submit" value="Check
Answers"/>
</fieldset>
</form>
</div>

</body>
</html>

NaveenKumar

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response