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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -