In my jsp on readyfunction i am setting value for some variables
$(document).ready(function() {
........////some code.......
var compCode=$('#companyCode').val();
........////some code.......
$("#countrySectorinMemInfo").val(countrySec);
........////some code.......
});
my controller is returning one value say ABC and i am accessing this value using ,
<input type="hidden" value="${ABC}" id="companyCode">
suppose , if my jsp has more than two fields having same id as “countrySectorinMemInfo”
then how ” $(“#countrySectorinMemInfo”).val(countrySec);” will work……
can anybody explain me …???
both vaues will get set or only last value will be set …?????
Multiple elements with the same ID is illegal in HTML. The browser behaviour is unspecified. Give them a different ID. If you need a common selector, use
nameorclassinstead.