I'm using jquery 1.5 and html4 standard.
I'm trying to set custom attribute which i get by javascript variable, but it is not setting up.code sample:
var attname="list1"; // this is changed on every call of the function where it is defined.
var attvalue="b,c,d"; // this also changed.
jQuery('#div1').attr({attname:attvalue});
but it treat attname as string itself rather variable. there are other option like using data(),prop() but they are supported in HTML5 and jquery 1.6 that is not possible for me at the moment.other problem is data can't be set on server side to be sync and used at client side by jquery data(). as they are syntactically diff. if there's some other way please suggest Thanks.
I guess you should use this
jQuery('#div').attr(attname,attvalue);