I was trying to implement a javascript code in my django admin, I have two fields hard_drives(id is: id_hard_drives) and no_of_drives(id is: id_no_of_drives). So, I want no_of_drives to appear only if hard_drives has particular value, like in the example:
<script type="text/javascript">
    $("#id_hard_drives").change(function () {
        if($("#id_hard_drives").val()=="125"){
            document.getElementById("#id_no_of_drives").type=text
        } else {
            document.getElementById("#id_no_of_drives").type=hidden
        }
    });
</script>
But, I get an error:
Unexpected token < 
Update :
As per GSWV, i have updated the code, but it still used to show same error, so i removed <script> tags. The new code looks something like this : 
(function($) {
   $(document).ready(function() {
       var hardDriveSelector = $("#id_hard_drives");
       hardDriveSelector.on("change", function(){
          if (hardDriveSelector.val() == "H") {
              document.getElementById("id_no_of_drives").type = text;
          } else {
          document.getElementById("id_no_of_drives").type = hidden;
          }
       });
     });
})(django.jQuery);
But the code is not being implemented on fly, the script dosen't do anything, do i need to use key up or something on id_hard_drives?
 
     
    