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)

Recommended Answers

All 2 Replies

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

Worked perfectly. Stupid jQuery. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.