I there, I have a javascript code that shows a div content depending on the select-box option value.
The code works fine in html, but in the Joomla 3.0 he doesn’t.
inside the php of Joomla i have this script:
<?php
//jQuery Framework in noConflict mode
JHtml::_('jquery.framework', false);
$document = JFactory::getDocument();
$document->addScriptDeclaration('
jQuery(document).ready(function(){
jQuery("select").change(function(){
jQuery( "select option:selected").each(function(){
if($(this).attr("value")=="3"){
$(".box").hide();
$(".choose").show();
}
if($(this).attr("value")=="5"){
$(".box").hide();
$(".green").show();
}
if($(this).attr("value")=="6"){
$(".box").hide();
$(".blue").show();
}
if($(this).attr("value")=="7"){
$(".box").hide();
$(".red").show();
}
});
}).change();
});
');
// Disallow direct access to this file
defined ( '_JEXEC' ) or die ( 'Restricted access' );
?>
And this HTML:
<select id="profiletypes" name="profiletypes" class="select required pt-font-color">
<option value="3">opção3</option>
<option value="5">opção5</option>
<option value="6">opção6</option>
<option value="7">opção7</option>
</select>
<div class="choose box">You have to select <strong>any one option</strong> so i am here</div>
<div class="red box">You have selected <strong>red option</strong> so i am here</div>
<div class="green box">You have selected <strong>green option</strong> so i am here</div>
<div class="blue box">You have selected <strong>blue option</strong> so i am here</div>
Hi Pullo, ty for ur attention. I only get some deprecated errors.
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; plgSystemSection has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/section/section.php on line 6
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; CApplications has a
deprecated constructor in /home/fanatic1/public_html/components/com_community/libraries/core.php on line 1118
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; plgSystemOfflajnParams has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/offlajnparams/offlajnparams.php on line 21
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP;
plgSystemOfflajnJoomla3compat has a deprecated constructor in /home/fanatic1/public_html/plugins/system/offlajnjoomla3compat/offlajnjoomla3compat.php on line 83
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; AzrulJXTemplate has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/template.php on line 22
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; AzrulJXCachedTemplate has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/template.php on line 71
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; plgSystemCentrora has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/centrora/centrora.php on line 32
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; plgSystemDojoloader has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/dojoloader/dojoloader.php on line 21
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; plgSystemModuleplant has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/moduleplant/moduleplant.php on line 23
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; JPlantContentPlugin has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/moduleplant/moduleplant/core/plugin/plugin.php on line 16
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; JAXResponse has a deprecated
constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/ajax.php on line 50
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; JAX has a deprecated
constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/ajax.php on line 208
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; Services_JSON has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/JSON.php on line 119
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; Services_JSON_Error has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/JSON.php on line 785
Deprecated: Methods with the same name as their class will not
be constructors in a future version of PHP; Services_JSON_Error has a
deprecated constructor in /home/fanatic1/public_html/plugins/system/jomsocial.system/pc_includes/JSON.php on line 799
Sry, I think you meant to say the erros of the firebug console. This is what I get;
ReferenceError: joms is not defined ___________________________________________ jomsocial.bootstrap.min.js:1:1
TypeError: $(…).attr is not a function___________________________________________ xipt:100:20