Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Whether to pass a javascript object to a function or id

HI,
I am making a search filter...
And how i am intending it to give it to user... is ...like :
user will provide the following html in its file :
<div id="filter"/>
And then in js will invoke my library with the parameter filter
And my code will replace this div with the search filter html and everything else....

Now there is an  alternative approach to this :
User can create a $('#filter') and pass it to my function or any other javascript object DOM Node etc...

Which approach is better passing the id as a string or passing an object... and which one....

Also the search filter html which i will return should append to this div element or replace this element ?

Thanks
SOLUTION
Avatar of Thomas Wheeler
Thomas Wheeler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial