What a genius!!
Liked the solution.

----- Original Message ----- From: <laredotorn...@zipmail.com>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Saturday, January 02, 2010 8:54 PM
Subject: [jQuery] Re: How do I extract this value?


Perfect!  5 stars - Dave

On Jan 2, 8:15 pm, MorningZ <morni...@gmail.com> wrote:
var hit = $("#myid").find("a").attr("href").match(/^.+\((\d+)\)$/);
if (hit && hit.length == 2) {
// hit[1] = "1234" in the example you provided}

else {
// didn't find the value

}

On Jan 2, 9:13 pm, "laredotorn...@zipmail.com"

<laredotorn...@zipmail.com> wrote:
> Hi,

> I am using JQuery 1.3. I have this basic structure in my HTML ...

> <li id="myid">
> ...
> <a class="edit" href="javascript:edit(1234)"> ... </a>
> ...
> </li>

> How do I extract the "1234" from HTML assuming I know the id of the
> <li> element?

> Thanks, - Dave

> ps - I know its bad practice to have the javascript function in there,
> but sadly this is code I inherited and I can't change the href at this
> point.

Reply via email to