开发者

jquery required field validator on click of anchor

开发者 https://www.devze.com 2023-03-11 03:20 出处:网络
I want to validate textbox on click of anchor with jquery required field valid开发者_开发问答ator http://docs.jquery.com/Plugins/Validation Can you let me know how can I do that? Bind a event to the c

I want to validate textbox on click of anchor with jquery required field valid开发者_开发问答ator http://docs.jquery.com/Plugins/Validation Can you let me know how can I do that?


Bind a event to the click of this anchor with this:

$("#field_id_you_want_to_validate").validate({
  rules: {
    required: true
  }
})


Let say you have anchor with id "myAnchor". This is how i write the code

$("#myAnchor").click(function(){
// Validate the Textbox that you want 

$("#textboxid").attr('class', 'required');

});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号