in your case you can use:
$('span[id^sp_span]') to get all span with id starting with sp_span
then you can get the id when is clicked
$('span[id^sp_span]').click(function(){
var spanID = $(this).attr('id').split('_')[1] ;will give you span1,
span2 etc
$('#'+spanID).slideToggle(slideSpeed);
});
sorry i got a typo error, the corrent code is:
$('span[id^=sp_span]').
On Jul 26, 8:39 am, FrenchiINLA mamali.sohe...@gmail.com wrote:
in your case you can use:
$('span[id^sp_span]') to get all span with id starting with sp_span
then you can get the id when is clicked
Okay, it seems to work well. Here is the jQuery that I have now:
--
$('span[id^=sp_span]').click(function(){
var spanID = $(this).attr('id').split('_')[1];
$('#'+spanID).slideToggle(slideSpeed);
$('span.contentSpan:not(#'+spanID+')').slideUp(slideSpeed);
});
--
First of all -
Oh, and...can I use a for loop to give me the result I want?
On Jul 26, 10:33 am, Blake stickynote...@gmail.com wrote:
Okay, it seems to work well. Here is the jQuery that I have now:
--
$('span[id^=sp_span]').click(function(){
var spanID = $(this).attr('id').split('_')[1];
I'm sorry for posting yet again, but it appears I may be able to use a
for loop. Here is what I have (jQuery):
--
for (i=0;isections.length-1;i++) {
$(span#sp_+sections[i]).click(function() {
$(span#+sections[i]).slideToggle(slideSpeed);
5 matches
Mail list logo