This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Using jQuery to Disable Text Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using jQuery to Disable Text Box" Watch "Using jQuery to Disable Text Box" New topic
Author

Using jQuery to Disable Text Box

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
    
    1
I am using the following function to attempt to disable input but it is not working:

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63334
    
  70

"not working" isn't helpful. Please read ItDoesntWorkIsUseless.

Try .attr() instead of .prop().


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Keith Wood
Author
Ranch Hand

Joined: Aug 28, 2012
Posts: 38

prop is the correct function to call. However, I suspect that the field you are trying to disable is part of the new content that comes from the load call. If that is the case, then you must only try to access it in the completed callback from the load.



Author of the upcoming "Extending jQuery" book from Manning.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63334
    
  70

Ah yes, if that's the case then the element won't yet exist when the statement is executed. Though I'd use the success callback rather than the complete callback (which is also called in the event of an error).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using jQuery to Disable Text Box
 
It's not a secret anymore!