We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,644 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Click/focus/etc doesnt work on a input field

Hello

Im trying to modify something when clicking on a input text field. The id of that field is cart[1223686][qty].

Tried your standard:

$j("#cart[1223686][qty]").click(function() {
alert("Handler for .click() called.");
});

But nothing. What is wrong?

(Yes, $j is correct)

2
Contributors
2
Replies
2 Hours
Discussion Span
4 Months Ago
Last Updated
3
Views
riahc3
 
Team Colleague
1,311 posts since May 2008
Reputation Points: 60
Solved Threads: 13
Skill Endorsements: 11

jQuery thinks you're looking for #cart with attributes [1223686][qty].

if you want to look for that element, you have to specify the id attribute and value instead. Like this :

$j("[id='cart[1223686][qty]']").click(function() {
    alert("Handler for .click() called.");
});
gon1387
Posting Whiz in Training
233 posts since Jan 2011
Reputation Points: 32
Solved Threads: 37
Skill Endorsements: 3

Worked perfectly. Stupid jQuery. Thanks.

riahc3
 
Team Colleague
1,311 posts since May 2008
Reputation Points: 60
Solved Threads: 13
Skill Endorsements: 11

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0590 seconds using 2.66MB