Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics (2014) Creating a Password Confirmation Form Perfect

Stanislaw Lorenz
Stanislaw Lorenz
8,903 Points

Submit button remains disabled - even after deleting the code which disables it

I am referring to the "jQuery Basics -> Creating a Password Confirmation Form -> Perfect" video

I cut the code to the essential part which is bothering me:

<!DOCTYPE html>
<html>
<head></head>
<body>
    <form action="#" method="post">
        <p>
            <input id="submit" type="submit" value="SUBMIT">
        </p>
    </form>
    <script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
    <script>

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

Now, if I add $('#submit').prop('disabled',true); between the script tags, the input gets an attribute "disabled" (as expected). You can see it in the console of your favourite browser.

But here comes the problem. If I delete $('#submit').prop('disabled',true);, the attribute "disabled" remains on the input tag.

Any idea what is causing this phenomenon? Fwiw, I am using Firefox 45.0.2 and this problem is not as issue with Workspaces (i tried it with Sublime also).

2 Answers

Matthew Lee-Mattner
Matthew Lee-Mattner
6,359 Points

Hey Stanislaw,

I can't seem to replicate the problem in my own workspace. The submit button appears to be working correctly with the code you've provided.

Make sure that you have saved the file and refreshed the preview browser.

Stanislaw Lorenz
Stanislaw Lorenz
8,903 Points

Hi Matthew,

have done that before. Problem remains.

So you're saying, after adding $('#submit').prop('disabled',true); to the code, saving and refreshing the browser, then deleting the line and saving and refreshing again... your Submit button becomes clickable again?

Lewis Marshall
Lewis Marshall
22,673 Points

I had the exact same thing happening to mine where the input was being kept as disabled even though I had removed the function to make the input disabled.

I think its down to browser's cache. So by pressing CTRL + F5 it removed the browser cache for this specific page and the disabled property for the input had now gone.