Hello,
i've a group of checkboxs built within a "Custom Element" as the following:
I want to trigger the change event when click on one of them returning the checkbox selected value.
I've tried so:
but it stops with error: "Ready is not a function".
If I test the same code on a online JQuery Simulator (such as http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide) it works!
Thanks
Guido
i've a group of checkboxs built within a "Custom Element" as the following:
<input type="checkbox" class="MyCheck" value="1"/>
<input type="checkbox" class="MyCheck" value="2"/>
<input type="checkbox" class="MyCheck" value="3"/>
I want to trigger the change event when click on one of them returning the checkbox selected value.
I've tried so:
$(document).ready(function() {
$('.MyCheck').click(function() {
if ($(this).is(':checked')) {
alert($(this).val());
}
});
})
but it stops with error: "Ready is not a function".
If I test the same code on a online JQuery Simulator (such as http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide) it works!
Thanks
Guido
No one helps me?
😢
😢
Hi Guido,
Is your code running under jQuery or MooTools? The two have confusingly different syntax. ChronoForms uses MooTools and so does Joomla!, though in Joomla! 3 jQuery is also available.
Bob
Is your code running under jQuery or MooTools? The two have confusingly different syntax. ChronoForms uses MooTools and so does Joomla!, though in Joomla! 3 jQuery is also available.
Bob
Hi GreyHead,
I'm within Chronoform and Joomla 2.5 so I presume I'm with MooTools.
Thanks for your support
I'm within Chronoform and Joomla 2.5 so I presume I'm with MooTools.
Thanks for your support
Hi Guido,
Then you need to write your script to work with MooTools and this isn't MooTools syntax :-(
Please try something like:
Bob
Then you need to write your script to work with MooTools and this isn't MooTools syntax :-(
$('.MyCheck').click(function() {
Please try something like:
window.addEvent('domready', function() {
$$('.MyCheck').each( function() {
this.addEvent('click', function() {
if ( this.checked ) {
alert(this.value);
}
});
});
});
Bob
Thanks GreyHead.
🙂
🙂
This topic is locked and no more replies can be posted.