I want to put some js on my article. Original code form http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_p
is:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
My article is at: http://xuzo.com/testing/node/44
Here is what I have done
put this code in content item source code:
<h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <p>Click me</p>Put this in JS Injector box:
$(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); });
and this for URL:
node/44
put this in my /public_html/testing/sites/all/themes/xuzo/template.php file:
drupal_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', 'external');Flushed all cache
Not working!!! ;)
Additionally...for this line of code to load JS files locally:
drupal_add_js('misc/collapse.js');
Where to put the JS file? I take it misc can be any folder name? But where to put the files in relation to root? Sites/all ?
