I am using this
var abc = jQuery('#pl_hid_addon_name').val();
alert(abc);
var atLeastOneIsChecked = jQuery('input[name="addon-"'+abc+']:checked').length ;
alert(atLeastOneIsChecked);
But it not worked It should be after concatenate like below
var atLeastOneIsChecked = jQuery('input[name="addon-base-bar2[]"]:checked').length;
The concat() function concatenates the string arguments to the calling string and returns a new string.
The best and fastest way to concatenate strings in JavaScript is to use the + operator. You can also use the concat() method.
Concatenation is the process of combining two or more strings to form a new string by subsequently appending the next string to the end of the previous strings. In Java, two strings can be concatenated by using the + or += operator, or through the concat() method, defined in the java. lang. String class.
Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs.
var atLeastOneIsChecked = jQuery('input[name="addon-"'+abc+']:checked').length;
^
|
You used the closing " at the wrong place
var atLeastOneIsChecked = jQuery('input[name="addon-'+abc+'"]:checked').length;
^
|
Try this -
var atLeastOneIsChecked = jQuery("input[name='addon-"+abc+"']:checked").length ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With