I want to set the width of an element after the page got loaded. For that I use this script:
<script type='text/javascript' src='https://radlvoo.de/wp-includes/js/jquery/jquery.js'>
jQuery(document).ready(function() {
var y = document.getElementsByClassName("col-sm-6");
for (var i = 0; i < y.length; i += 1){
y[i].style.width = "100%";
}
});
</script>
But it isn't working. If I replace the jQuery(document).ready(function() {
with a real function, lets say changeWidth()
it is working..
Try it yourself here. You can see, that this one will expand if you call changeWidth()
in the console:
enter image description here
Further, if I leave that out type='text/javascript' src='https://radlvoo.de/wp-includes/js/jquery/jquery.js'
, it says:
jQuery is not defined
What is the reason for this and how can I fix that?
Kind regards