[eluser]alexaaaaaaaaaa[/eluser]
Ok, first of all i'm very very sorry that i use this forum for something about javascript but i really need it.
Here's what i have done.
I have created a drop down with categories and subcategories (cascading drop down) and i use prototype for that, and the problem is that when i put prototype side by side with jquery doesn't work.
So what i want is to migrate or convert prototype code into jquery
Here's my prototype code
Code:
document.getElementById('test')[removed] = '<img src="<?php echo image_url('load3.gif');?>" alt="loading" />' + 'Loading'
function getCat(id,count,catid){
document.getElementById('catInner')[removed] = '<img src="<?php echo image_url('load.gif');?>" alt="loading" />' + ' Loading'
for(i=0;i<count;i++)
{
if(i == id)
{
document.getElementById("gr"+i).setAttribute("class", "selected");
document.getElementById("gr"+i).setAttribute("className", "selected");
}
else
{
document.getElementById("gr"+i).setAttribute("className", "");
document.getElementById("gr"+i).setAttribute("class", "");
}
}
new Ajax.Request('<?php echo $base_url.'/home/getCate/'; ?>'+catid,
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText || "no response text";
document.getElementById('catInner')[removed] = response
},
onFailure: function(){ alert('Something went wrong...') }
});
}
<?php
if($groups->num_rows()>0)
{
$row_count=$groups->num_rows();
$i=0;
foreach ($groups->result() as $catarray)
{
if($i==0)
{
$firstcatid=$catarray->id;
$i++;
}
}
}
?>
<?php if($groups_num > 0){?>
getCat('0','<?php echo $row_count; ?>','<?php echo $firstcatid; ?>');
<?php } ?>
Thanks in advance and sorry again.
ps. i have checked jquery forum.