JavaScript jquery breaking another javascript jquery breaks another javascript

I am using a datepicker which came deafult with a html template , everything worked fine untill i used a custom jquery to hide a div using a radio button ...

here are my top scripts

<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" ></script>
<script type='text/javascript' src='js/plugins/jquery/jquery-ui.min.js'></script>
<script type='text/javascript' src='js/plugins/jquery/jquery-migrate.min.js'></script>
<script type='text/javascript' src='js/plugins/jquery/globalize.js'></script>    
<script type='text/javascript' src='js/plugins/bootstrap/bootstrap.min.js'></script>
<script type='text/javascript' src='js/plugins/mcustomscrollbar/jquery.mCustomScrollbar.min.js'></script>
<script type='text/javascript' src='js/plugins/uniform/jquery.uniform.min.js'></script>
<script type='text/javascript' src='js/plugins/knob/jquery.knob.js'></script>
<script type='text/javascript' src='js/plugins/sparkline/jquery.sparkline.min.js'></script>
<script type='text/javascript' src='js/plugins/flot/jquery.flot.js'></script>     
<script type='text/javascript' src='js/plugins/flot/jquery.flot.resize.js'></script>
<script type='text/javascript' src='js/plugins.js'></script>    
<script type='text/javascript' src='js/actions.js'></script>    
<script type='text/javascript' src='js/charts.js'></script>
<script type='text/javascript' src='js/settings.js'></script>

if i use this then datepicker is working fine but my jquery is not working , my jquery code is

<script type="text/javascript">
    $(document).ready(function () {
        $("#vodn").trigger("click");
        $('#div1').hide('fast');
        $('#vod').click(function () {
            $('#div2').hide('fast');
            $('#div1').show('fast');
        });
        $('#vodn').click(function () {
            $('#div1').hide('fast');
            $('#div2').show('fast');
        });
    });
</script>

my jquery is only working if i call this jquery.min.js before my jquery

<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" ></script>

BUT the problem is then my custom jquery is working but datepicker is not working (may be because i am calling jquery.min.js twice) , what mistake am i doing and how to correct it ...

EDIT : i observed that when i use noconflict the place where i import the jquery.min.js is affecting the page , if i import it before js/plugins.js then my date picker is not working and if i import it after plugins.js then my custom code is not working

Answer:1

add noConflict on very first line of your jquery script

var $ = jQuery.noConflict();
$(document).ready(function () {
    $("#vodn").trigger("click");
    $('#div1').hide('fast');
    $('#vod').click(function () {
        $('#div2').hide('fast');
        $('#div1').show('fast');
    });
    $('#vodn').click(function () {
        $('#div1').hide('fast');
        $('#div2').show('fast');
    });
});
Answer:2

your jquery files are conflicting. Try doing the following:

var j = $.noConflict();

then you initialize your datepicker through the variable j.

For example.

j("#your-selector").datepicker();
Answer:3

I have been working with the excellent noUISlider jQuery plugin and now I want to start using the npm version as I am moving my JS to use node and browserify. However I don't understand how to adapt ...

I have been working with the excellent noUISlider jQuery plugin and now I want to start using the npm version as I am moving my JS to use node and browserify. However I don't understand how to adapt ...

  1. browser version using jquery
  2. using multiple version of jquery
  3. check browser version using jquery

I'm trying to load an image from a URL into a HTML canvas at a 1:1 scale. I load the image, and set the canvas DOM element to the appropriate dimensions, but for some reason the image in the canvas is ...

I'm trying to load an image from a URL into a HTML canvas at a 1:1 scale. I load the image, and set the canvas DOM element to the appropriate dimensions, but for some reason the image in the canvas is ...

  1. using canvas to draw
  2. using html5 draw canvas containing star
  3. draw using canvas android

Im having problems with a webgl build for unity that uses a ftp connection to store and load .xml files. Everything works fine in the editor and on a local ftp server (using Xlight). But when I build ...

Im having problems with a webgl build for unity that uses a ftp connection to store and load .xml files. Everything works fine in the editor and on a local ftp server (using Xlight). But when I build ...

  1. webgl error chrome
  2. opengl error 1281
  3. opengl error 1282
  4. opengl error
  5. opengl error minecraft
  6. opengl error 1281 minecraft
  7. opengl error 1280
  8. opengl error 1283
  9. opengl error 1286
  10. opengl error codes
  11. opengl error 1285
  12. opengl error 65542
  13. opengl error 1284
  14. opengl error 0x502
  15. opengl error checking
  16. opengl error 1282 gl_invalid_operation
  17. opengl error out of memory minecraft
  18. opengl error string
  19. opengl error invalid operation
  20. opengl error photoshop

I need to submit a programmatically created form using plain Javascript (no JQuery). Everything works, except the post data arrives on the server without quotes (which the C# JsonConvert....

I need to submit a programmatically created form using plain Javascript (no JQuery). Everything works, except the post data arrives on the server without quotes (which the C# JsonConvert....

  1. make form submit on enter
  2. make form submit ajax
  3. make form submit jquery
  4. make form submit javascript
  5. make form submit button a link
  6. make form submit synchronous
  7. make form submit not refresh
  8. make form not submit
  9. jquery make form submit ajax
  10. make a form submit
  11. make button submit form
  12. make form disappear after submit button
  13. make div submit form
  14. make link submit form
  15. make form button not submit
  16. make anchor submit form
  17. make checkbox submit form
  18. make href submit form
  19. make button submit form html
  20. make span submit form