Pages

Sunday, October 21, 2012

Use the javascript element for jquery functions

I was working on one of the functions and had pass an js element to it and wanted to perform jquery functions which require an id in format $("#id")

Here is how to use jquery operations on an element received in js format


//ele is an checkbox element
function enabletext(ele)
{
    if(ele.checked==true)
    {
        var myid=ele.id;
        jQuery(eval("'#" + myid + "'")).parent().siblings("#qtyid").show();
    }
}

1 comment:

  1. Good article

    https://wordpress-special-plugin.blogspot.co.id

    ReplyDelete