Is it possible to implement associative arrays as Selectors and Values.
I have an array
var obj = { surgeon:1, asstSurgeon:2, anesthe:3, nurse:4, scrub:5,....... };
I am able to implement like this.
$("#surgeon").click(function(){
$("$hiddenvariable").val(1);
});
$("#asstSurgeon").click(function(){
$("$hiddenvariable").val(2);
});
................,
Can anyone help me how can i reduce the code.
Is there any other way to implement this.
with jQuery
$.eachor Using
for..inand.on. (Above method is better than below)