Here is my code:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$('.tree div').click(function(){
var id = $(this).attr('id');
$('.tree div:regex(id,^['+id+'_])').html('this one');
});
});
</script>
<div class="tree">
<div id="item_1">
<a href="<?php echo $this->url(array('action' => 'ketab')); ?>"><?php echo $this->translate("Add Ketab"); ?></a>
</div>
<div id="item_1_1">
<span></span>
<a href="<?php echo $this->url(array('action' => 'ketab')); ?>"><?php echo $this->translate("Add Ketab"); ?></a>
</div>
<div id="item_1_2">
<span></span>
<a href="<?php echo $this->url(array('action' => 'ketab')); ?>"><?php echo $this->translate("Add Ketab"); ?></a>
</div>
</div>
I want hide item_1_1 and item_1_2 when i click on item_1, I don't know how can i do that with regex.
I use http://james.padolsey.com/javascript/regex-selector-for-jquery/ for regx
<pre><code>tags though. Just paste your original HTML and press the{}code button. For newlines, rather than using<br/>, just press enter twice.