TOPIC:

Div input type color with localstorage 3 months 12 hours ago #260505

  • Topic Author
  • kkvbsuresh
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
The below following is the full code where i am trying to learn the localstorage and the localstorage doesn't work.


<!DOCTYPE html>
<html>
<head>
<script src=" ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js ">
<style>


.div1 {
background-color: #ff0;width:150px;height:150px;
}
</style>
</head>
<body>

<h2>HTML Table</h2>

<input type="color" id="colorit" onchange="setColor()"/>
<div class="div1">

</div>

<script>

$(".div1").localStorage.getItem('bgcolor') ;
var ClassName;

function setColor() {
//localStorage.setItem('background', $('#colorit').val());
ClassName = $('#colorit').val();
$('.div1').css('background-color', ClassName);
localStorage.setItem('bgcolor', 'ClassName');
}

function getColor() {
//localStorage.getItem('background');
$('#colorit').val(ClassName);
localStorage.getItem('bgcolor') ;
}

setColor();

</script>
</body>
</html>


Could you able to solve it ?

Looking forward for a kind help.

Cheers

varghese

Please Log in or Create an account to join the conversation.

Div input type color with localstorage 3 months 11 hours ago #260509

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6901
  • Karma: 3
  • Thanks: 492
Hi,

you want to change color of form? or?

Could you please explain it a little better what you want to do with this code?

If you want to change something in the form, please send me link of that page with form, and I will provide you with correct css

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Div input type color with localstorage 2 months 4 weeks ago #260558

  • Topic Author
  • kkvbsuresh
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hi,

The localstorage is not functioning due to some reasons ? Means the selected color don't appear when revisit or reload the page ?


I don't know the reason or reasons.

I am get a help from here to solve it out ?

Cheers

varghese

Please Log in or Create an account to join the conversation.

Div input type color with localstorage 2 months 4 weeks ago #260563

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6901
  • Karma: 3
  • Thanks: 492
Hi,

probably you put this code in wrong place, could you please send me link of your page, and I will provide you with correct css, and tell you where you need to put the code?

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.046 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!