Complete BLoC with Clean Architecture (group chat) Discount !! E-commerce App With Backend Source Code Video and Voice Chatting App Firebase Chatting App Source Code Complete Gym App BLoC State Management Source Code Complete Study App Buy Ticket Booking App Source Code Buy Travel App With Backend Source Code Complete Chat App Udemy Course Special Offer Discount !! Online Learning Course App (BLoC) Online Learning Course App (Riverpod) Online Learning Course App (Getx) Discount !! Shopping App (Provider) Cool Flutter Game Flutter Nodejs Chat App Flutter Nodejs Api And Firebase Chat App Riverpod Task Management App
Here, we will use pure Javascript to find a tag and style the tag attributes. We will find span
tag using Javascript.
Let's see how to find it. We may use the document function getElementsByTagName(), this will take any tag and find it for you if it exist.
let spanTag = document.getElementsByTagName('span');
You may find any tags like this. Here I created a variable name spanTag
and saved all the tags name span
. After that we will use for loop to loop through and find certain attriabutes.
After that we will look for style attribute, to find any attribute you may just use getAttribute() function.
spanTag.getAttribute("style")
See inside getAttribute() how we find attribute.
Now let's see our for loop
let spanTag = document.getElementsByTagName('span');
if(spanTag.length){
for(var i=0; i<spanTag.length; i++){
var tag = spanTag[i];
if(tag.getAttribute("style")){
if(tag.style.textDecoration=="underline"){
tag.style.fontSize="26px";
tag.style.color="#0b99d0";
}
}
}
In the loop, we style the attribute's properties. Using the above tips, you may find any tags and style the attributes properties.