I have a form with 5 icons and I want to validate which one is clicked. I thought to add a hidden text box and write a rule which checks the value of it. This works on form submit, but I need the error message to be cleared on clicking the correct image. At the moment, the validation is not fired when the text value is changed by javascript. Any better way of doing this?

```
<form name="frmExperiment" id="frmExperiment" action="" method="post">
<img src="btn1.png" width="75" height="75" alt="continue" title="continue" onclick="frmExperiment.txtIconG.value=1" />
<img src="btn2.png" width="75" height="74" alt="information" title="information" onclick="frmExperiment.txtIconG.value=2" />
<img src="btn3.png" width="75" height="82" alt="refresh" title="refresh" onclick="frmExperiment.txtIconG.value=3" />
<img src="btn4.png" width="75" height="75" alt="home" title="home" onclick="frmExperiment.txtIconG.value=4" />
<img src="btn6.png" width="75" height="77" alt="stop" title="stop" onclick="frmExperiment.txtIconG.value=5" />
<input type="text" name="txtIconG" id="txtIconG" />
</form>

```

and

```
$.validator.addMethod("iconmatch", function (value, element) {
return value==1;
},
"That isn't the continue button"
);

```