1.11M Members

Click/focus/etc doesnt work on a input field

 
0
 

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)

 
1
 

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.");
});
 
0
 

Worked perfectly. Stupid jQuery. Thanks.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article