views:

32

answers:

1

I wanna high light particular div when the page.isvalid=false. on the pageload i am able to get display the error message. But the issue is that i am not able to highlight the control which is required.

I have a js function which sets the error class to the div. Its working fine when i click on a button. On the page load i wanna set this as well.

can i do this using some jquery??? or something other way..

Please let me know how to do this.... share your ideas....

Thanks

+1  A: 

yes you can do this by using jquery

 $(document).ready(callOnload); 

    function callOnload() {
    //add code to highlight div 
//following code is used by me to hightligh input control with has isreqired = true 
      $("input[isRequired=true]").each(
                        function(n) {
                            $('#' + this.id).addClass('mandatory');

                            if (this.value === '') {
                                $('#' + this.id).removeClass('normal');
                                $('#' + this.id).addClass('mandatory');
                            }
                            else {
                                $('#' + this.id).removeClass('mandatory');
                                $('#' + this.id).addClass('normal');
                            }

                        }
             );
    }
Pranay Rana