Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to replace with a filled with CSS?

How to replace <input text box> with a <div> filled with CSS?

Problem

This is my first time asking a question on Stack Overflow, forgive me if I mess up the formatting. I'm trying to Replace an Input Password Box with a with class=accessGranted CSS. When a user types into the input box and presses enter it should replace the input box with a with CSS .accessGranted.

It should replace the input password box with ACCESS GRANTED in green letters. Also I can't figure out how to get rid of the ACCESS GRANTED that automatically shows up on the page. The JSFiddle link will show you what I am talking about.

HTML:

     

       

CSS:

    .accessGranted:before {
        font-size: 20px;
        color: #4eff73;
        font: sans serif;
        margin-top: 200px;
        margin-left: 200px;
        display: block;
        content: "ACCESS GRANTED";
     }







    body {
      background-color: #000;
    }

   .passwordPress {
      margin-top: 200px;
      margin-left: 200px;

    }

JQuery:

   $('.passwordPress').bind("enterKey",function(e){
          alert("Enter");
                });
         $('.passwordPress').keypress(function(e){
         if(e.keyCode == 13)
           {
        $(this).replaceWith('
'); } });

Here is a link to JSFiddle: http://jsfiddle.net/x7HVQ/606/

Problem courtesy of: user3663015

Solution

How to get rid of the ACCESS GRANTED that automatically shows up on the page:

Just remove the

in html body


JSFiddle

Solution courtesy of: jhyap

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

How to replace with a filled with CSS?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×