Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if div contains background image

// HTML EXAMPLE
<div id="element2" class="element"></div>

//Css example .element {
  background-image: url('http://www.todayifoundout.com/wp-content/uploads/2010/05/blue-sky.jpg');
  width: 350px;
  height: 350px;
}
//your script JS
var background = $('.element').css('background-image')
if (background.indexOf("blue-sky.jpg") >= 0) {
    document.getElementById("element2").style.backgroundImage = "url(https://images.freeimages.com/images/premium/previews/2272/22721547-omg-face.jpg)";
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: using express js response render parameter in ejs script tag as a variable in node js 
Javascript :: map keys to list node js 
Javascript :: Beautifule JS Console Log 
Javascript :: javascript perform click 
Javascript :: js validation library 
Javascript :: convert html to docx javascript 
Javascript :: componentwillunmount hooks 
Javascript :: toast 
Javascript :: json.stringify 
Javascript :: datepicker react native 
Javascript :: jQ - on image load 
Javascript :: react native docs 
Javascript :: function that duplicates data in array js 
Javascript :: handleClickoutside custom hook react 
Javascript :: validação de email email@email.com 
Javascript :: Sort an array by both ascending and descending order in js 
Javascript :: canvas drawimage resize quality 
Javascript :: cypress run specific test 
Javascript :: ticking clock react js 
Javascript :: how to run socket.io server 
Javascript :: export default 
Javascript :: history javascript 
Javascript :: import and export type in js 
Javascript :: mongodb node js 
Javascript :: jquery get table to object 
Javascript :: react particles 
Javascript :: defer parsing of javascript avada 
Javascript :: npm koa 
Javascript :: how to swap two images in javascript 
Javascript :: range of numbers in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =