JQuery - disable links if any form inputs change.

Posted on 2010-09-24
Last Modified: 2012-05-10
I am desperate for a bit of JQuery code that when a class is given to a form, if any of the inputs change without the submit being clicked, it will disable all links on the page and put an 'are you sure' message up.
I imagine that if any $('input') gets focus then it calls a function to add a class to disable links, but if $(input[type='text']) is pressed then the disable links class is removed...
Question by:jdav357
  • 2
LVL 40

Accepted Solution

gurvinder372 earned 250 total points
ID: 33752514


function disableAllLinks()
LVL 82

Assisted Solution

leakim971 earned 250 total points
ID: 33755090
You can use multiple selectors for example if you don' want to do something when textbox is clicked (input[type='text']) use the not-equal selector :

You can have multiple selector, for example :


Author Closing Comment

ID: 33835911
LVL 82

Expert Comment

ID: 33835926
You're welcome! Thanks for the points!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Allow space in this pattern 2 48
Download a website to hdd 2 49
highcharts wont fix inside a bootstrap modal window 6 29
Change javascript css 1 19
In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now