I am trying to add javascript to my page and use type="text/javascript" however when I include the following it just encloses it in script tags. How can I fix this? Also, how can I add the type="text/javascript to external files (see the second example)
drupal_add_js("$(document).ready(function() {
// Infinite Ajax Scroll configuration
jQuery.ias({
container : '#itemcontainer',
item: '.dealstable',
pagination: '.nav',
next: '.nav a',
});
});",'inline');
Here is the second example:
drupal_add_js('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js','external');
UPDATE: As suggested by the comments I tried the following:
$js = "(function($) {
jQuery.ias({
container : '#itemcontainer',
item: '.dealstable',
pagination: '.nav',
next: '.nav a',
});
};
})
(jQuery)";
drupal_add_js($js, array('type' => 'inline','scope'=>'footer'));
But that resulted in the following HTML:
<script>(function($) {
jQuery.ias({
container : '#itemcontainer',
item: '.dealstable',
pagination: '.nav',
next: '.nav a',
});
};
})
(jQuery)</script>