Note that there are some explanatory texts on larger screens.

plurals
  1. POChange background of Div from select
    primarykey
    data
    text
    <p>I have made the following, which works, fine. It changes the background of a Div onSelectChange from a dropdown. I’m sure there is abetter way. Could anybody recommend?</p> <p>Thank you for looking.</p> <pre><code>$(document).ready(function() { $("#QuoteRequiredFor").change(onSelectChange); }); function onSelectChange() { var selected = $("#QuoteRequiredFor option:selected"); var output = ""; if (selected.val() == '') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/images/FFheaderQuoteFactoring.jpg)'); }; if (selected.val() == 'Factoring') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/factoring.jpg)'); }; if (selected.val() == 'Mortgage') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/Mortgage.jpg)'); }; if (selected.val() == 'Stock') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/stock.jpg)'); }; if (selected.val() == 'Asset') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/asset.jpg)'); }; if (selected.val() == 'Invoice discounting') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/factoring.jpg)'); }; $("#output").html(output); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload