javascript - alternate option for getElementById in JS? -


i have mvc app.

i have written js code below in "create" view. code below code works in google chrome , mozilla firefox; it's not working in ie 8.

$('#paymenttype').change(function(){                         var ptype=document.getelementbyid("paymenttype").value;                 }); 

so changed code below , works... on ie 8

$('#paymenttype').change(function(){                          var ptype = $(this).val();                 }); 

now, problem not going use getelementbyid anymore...

what if want values control? alternate option there available getelementbyid?

you use $('#otherid').val() value.

also on side note in second code example could've used var ptype = this.value;


Comments