Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Toggle image onclicking parent

$(function(){ 
    $(".dropdown-toggle").click(function(){ 
   $(".arrow").attr('src',  
                ($("img").attr('src') == 'images/icon-arrow-down.svg'  
                    ? 'images/icon-arrow-up.svg'  
                    : 'images/icon-arrow-down.svg' 
                     ) 
                )  
    }); 
}); 
//Here .dropdown-toggle is parent class and .arrow is child class
//This toggles image src on click
//This works if there is one child with .arrow class as im multiple .arrow classes if affects all.
Comment

PREVIOUS NEXT
Code Example
Javascript :: python code to javascript converter 
Javascript :: If you wish to set a method equal to another method in the class 
Javascript :: JavaScript get div height dynamically without jQuery 
Javascript :: how to skip the else statment in react tertiary 
Javascript :: ahead-of-time (AOT) compilation 
Javascript :: prisma graphql n+1 problem solution 
Javascript :: javascript goto or redirect to page 
Javascript :: load limited data and search data from all in angularjs 
Javascript :: stringToCapital.js 
Javascript :: wp include js 
Javascript :: simple express server responce html css js 
Javascript :: miragejs url parameters 
Javascript :: backbone view initialize 
Javascript :: Backbone Sync And Fetch 
Javascript :: document.getelementbyid add number 
Javascript :: react native long form up input 
Javascript :: js pipe 
Javascript :: react native raw bottom sheet 
Javascript :: convert jquery to javascript converter online tool 
Javascript :: how to scroll automatically to the bottom of the page using javascript 
Javascript :: comment field react 
Javascript :: subarray javascript 
Javascript :: animate js 
Javascript :: client position js 
Javascript :: inappbrowser hide url 
Javascript :: selectize in ajax call 
Javascript :: javascript WeakMaps Are Not iterable 
Javascript :: javascript Number() Method Used on Dates 
Javascript :: jQuery Traversing - Descendants 
Javascript :: nodejs: express, morgan, mongoose package 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =