How to validate list through spring validator

I am trying to doing very simple thing is JQuery. I want to get all the select element of page having some specific pattern like . ‘mdrFormBean.bankMDRFormBean.externalFeeTemplatesFormBean0’ in this string last char 0 is variable, it can be 0,1,2,3 and so on. For this I write a one JQuery.

var count = 0;
$("select").each(function() {
    var ddId = $(this).attr('id');
    if(ddId.indexOf("mdrFormBean.bankMDRFormBean")){
        console.log(ddId);      
    } else {
        console.log("NotFount");
    }
    count++;
});

In this script I have two question.
First : It is giving me one exception
‘Uncaught TypeError: Cannot read property ‘indexOf’ of undefined’
Second : is there any pattern so that I can find specific pattern id.Because current script will return all the select element form the page then check them on condition basis. If possible please give me some piece of code.


Source: javascript

Leave a Reply