I have three product attributes named gross_weight,stone_weight & net_weight. While entering stone_weight the net_weight should be calculated using jquery. But jquery is not recognizing input field by its name. input field names are like name="product[net_weight]".
Please suggest any solution for this problem.
1 Answer 1
We can simply call with backslashes:
$('input[name="product\\[net_weight\\]"]')
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \. For example, an element with id="foo.bar", can use the selector $("#foo\.bar")
We can see more here:
-
a big thanks for helping me. but i cannot able to trigger change or keyup events using the same logicShiyas Pathiyassery– Shiyas Pathiyassery2016年12月29日 05:00:37 +00:00Commented Dec 29, 2016 at 5:00
-
@ShiyasPathiyassery you should open new question. I will take a look.Khoa Truong– Khoa Truong2016年12月29日 05:01:40 +00:00Commented Dec 29, 2016 at 5:01
-
Bro actually my question is really regarding the same issue. ie, event based on this element(s) not working properly so i cannot able to do anything with change or keyup events.Shiyas Pathiyassery– Shiyas Pathiyassery2016年12月29日 06:31:24 +00:00Commented Dec 29, 2016 at 6:31
-
I think it is a different issue. I know your issue may related to UI component. You cannot bind the event to the elements?Khoa Truong– Khoa Truong2016年12月29日 06:34:01 +00:00Commented Dec 29, 2016 at 6:34
-
Yes bro. That's what my actual problem. how to solve this problemShiyas Pathiyassery– Shiyas Pathiyassery2016年12月29日 06:40:10 +00:00Commented Dec 29, 2016 at 6:40
Explore related questions
See similar questions with these tags.