javascript - Display actual Image from Switch Function instead of URL text -


I am working on a script and in addition to this, I have to do the job that I div ID) to show a real image and not only the URL of the image.

You can see it.

In addition, I would like to display a background image default image ... Once again when you select the input, the image on the background image changes.

Here is part of a script that generates a URL

  $ ('# show_image_text') HTML (image_name). // Put $ url URL ('# show_image'). Html (image_name); // Enter the image value in the Formula Image field src});   

Here is the div where I want to display the image. Style requirement for width , height , and background-image

      

Change your code as follows:

$ (' #show_image '). CSS ('background-image', 'url' ('+ +' + image_name + '') ");

In addition, div #show_image There is no height set, so the image will not appear until you set it to its height explicitly

  #show_image {height: 50px; width: 200px; background -image: url ('path on default image'); // You can set a default image like this, which will override after the image is set in the code ...}   < p> updated   

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -