Jump to content

javascript and/or jquery help


dadamssg

Recommended Posts

I have a color picker on my page that puts the hex value in an input box. I'm not familiar with jquery or javascript in general. I would like to be able to take the hex value and use it in updating a style of a div...say the border color for example. Something like this...but this isn't working.... :confused: any help would be awesome!

 

<input type="text" id="colorfield1" onFocus="ddcolorposter.echocolor(this, 'colorbox1')"> <div id="colorbox1" class="colorbox"></div>

<br><br>
<div id="testbox"> Some Text </div>

<script>
    $("#colorfield1").keyup(function () {
      var value = $(this).val();
      $("#testbox").style.border="1px solid "+ value;
    }).keyup();
</script>


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.