ASP.NET MVC Validation Using qTip jQuery Plugin

前端 未结 2 946
有刺的猬
有刺的猬 2021-02-03 12:54

I am using the solution found here to show client side validation errors in a tooltip using the qTip jQuery plugin. This solution works great for client side validation but I w

2条回答
  •  半阙折子戏
    2021-02-03 13:40

    The solution posted by Nick Olsen works great ! One observation :

    The .replace() used in this statement only replaces the first occurrences of ‘.’ ‘[' and ']‘

    var inputElem = ‘#’ + $(this).attr(‘data-valmsg-for’).replace(‘.’, ‘_’).replace(‘[', '_').replace(']‘, ‘_’);
    

    To replace all occurrences the line should be something like :

    var inputElem = "#" + $(this).attr("data-valmsg-for").replace(/\./g,"_").replace(/[\[\]]/g, "_");
    

提交回复
热议问题