Awesome! : D
Thank you very much

On Jan 19, 9:55 pm, "Mauricio \(Maujor\) Samy Silva"
<css.mau...@gmail.com> wrote:
> Try this:
>
> $('.boxy').each(function(i) {
> $(this).attr('id', 'myBoxNum' + i);
>
> }
>
> Maurício
>
> -----Mensagem Original-----
> De: "Ignacio Ricci" <ignacio.ri...@gmail.com>
> Para: "jQuery (English)" <jquery-en@googlegroups.com>
> Enviada em: segunda-feira, 19 de janeiro de 2009 22:36
> Assunto: [jQuery] Numerize set of ids
>
> > Hello there, I'm new to Jquery, and I've been seraching the site for a
> > while and couldn't get an answer to my problem. Here is my code:
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> >www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> > <title>Jquery add ids</title>
> > <script type="text/javascript" src="js/jquery.js"></script>
> > <script type="text/javascript">
>
> > $(document).ready(function (){
>
> > var obj = $('.boxy');
> > var repeatIdName = 'myBoxNum';
> > i = 1, 2, 3, 4, 5, 6, 7, 8; //Count
>
> > $('.boxy').attr('id', (repeatIdName + i));
>
> > });
> > </script>
> > <style type="text/css">
>
> > body {margin:0; padding:0;}
> > .boxy {margin:30px; padding:10px; border:1px dotted #CCC; width:
> > 400px; background:#EEE;}
>
> > </style>
> > </head>
>
> > <body>
>
> > <div class="boxy"><strong>Contenido</strong></div>
> > <div class="boxy"><strong>Contenido</strong></div>
> >    <div class="boxy"><strong>Contenido</strong></div>
> >    <div class="boxy"><strong>Contenido</strong></div>
>
> > </body>
> > </html>
>
> > I want to add an unique id to all boxy elements. I already tried with
> > for {i =0; i <=10... stuff also, I'm quite lost.
>
> > I appreciate your help.
> > Regards,
>
> > Ignacio

Reply via email to