jquery - Get values of a key array by using the class name which one is similar to array name -
i have key array named "type". name of array class name 'th' tag. want array values using class name of 'th' tag. there possibility this......
<script> var type= [{sym :"1" ,desc: "one"}, {sym:"2" ,desc:"two"},{sym: "3" ,desc:"three"}]; </script> <html> <body> <table> <th class="type"> </table> </body> </html>
you can store array (or several ones) in object, using class names keys:
var arrays = { type: [{sym: "1", desc: "one"}, {sym: "2", desc: "two"}, {sym: "3", desc: "three"}] }; then can utilize class name later array:
var typearray = arrays[$("th").attr("class")]; jquery html
No comments:
Post a Comment