Add Class
<script>
(function($){
jQuery(document).ready(function($) {
$( window ).on('scroll', function(){
$(".acc-section-3 .bg-overlay-image").addClass("fade-up");
});
});
})(jQuery);
</script>
Add Attribute with value
<script>
(function($){
jQuery(document).ready(function($) {
$( window ).on('load', function(){
$(".gallery-items figure img").attr("data-aos", "zoom-in");
});
});
})(jQuery);
</script>
<script>
$( "img" ).attr({
src: "/resources/hat.gif",
title: "jQuery",
alt: "jQuery Logo"
});
$( "div" ).text( $( "img" ).attr( "alt" ) );
</script>
Remove Attributes
<script>
(function($){
jQuery(document).ready(function($) {
$( window ).on('load', function(){
$(".gallery-items figure img").removeAttr("loading");
});
});
})(jQuery);
</script>
<!-- jQuery code to show the working of this method -->
<script>
$(document).ready(function () {
$("button").click(function () {
$("p").removeAttr("style");
});
});
</script>
Set the src attribute from title attribute on the image.
<img title="hat.gif">
<script>
$( "img" ).attr( "src", function() {
return "/resources/" + this.title;
});
</script> Page 8 of 95