replacing inline javascript with jquery

Newton21205
Newton21205 used Ask the Experts™
on
im relaxing the inline javascript by jquery.
I have attached two files one is having code with inline javascript.
The other file is having code with the jquery.

I want to verify if the query i have written is correct and would work as expected.
inline-javsacript-replaced-by-jquery
Inline-javascript
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
greetings Newton21205 , , , the code in your javascript is way too OLD, and out of date, as you have tests for things that in year 2017, that do not even exist any more -

        else if (navigator.appName=="Netscape"){
            NS6=parseInt(navigator.appVersion)>=5;
            NS4=4>=parseInt(navigator.appVersion);

these tests for "Netscape" are not valid, as "Netscape" no longer exists, , . .

In my view, Your best bet is to abandon that old javascript code, and start over with code that is more current, and corresponds to the HTML and Javascript standards used in browsers today.

Also, you can use non-Jquery, plain javascript to eliminate the "Inline" HTML javascript used.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Also your code seems incomplete - as you have it it does not make sense. You have script that refers to checkboxes in MainForm but the checkboxes exist outside of any form - there is also "onlick" code wandering about by itself outside of an element.
IT Expert
Top Expert 2009
Commented:
This is also not correct

$('#setform').on('onclick', function(){  

Open in new window


should be

$('#setform').on('click', function(){  

Open in new window


There is no need to prefix the javascript: label in handlers and you really should assign them unobtrusively using the jQuery you now want to use.

Like
$("[name='qrytype']").on("click",function() {
  $(".key").hide();
  $("#"+$(this).data("key")).show();
});

Open in new window

using

<input type="radio" name="qrytype" data-key="keystore".... />

and

<div class="key" id="keystore" ...>

Author

Commented:
done

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial