Menu

How to pass an element to a javascript function

2012-12-24
2012-12-26
  • Arjun Raman

    Arjun Raman - 2012-12-24

    If i want to pass an element to a javascript function, like say a selected element, how would i do it?

    ex :
    this.getElementXPath = function(element)
    {
    if (element && element.id)
    return '//*[@id="' + element.id + '"]';
    else
    return this.getElementTreeXPath(element);
    };
    The above is the code that i have to get the XPath of an element. How can i pass the selected element to it?

    Thanks,
    Arjun

     
  • Radek Burget

    Radek Burget - 2012-12-26

    I am not sure how exactly you combine CSSBox with JavaScript. Currently, there is no built-in javascript support in CSSBox and I am not aware about any cotnext where you could pass a Java object directly to a JavaScript function. Are you using some javascript implementation such as Rhino?

    Radek

     

Log in to post a comment.