javascript - Call automatically JS function with parameters inside <div> element -
i've tried find answers on internet this.. didn't find :(
i'm trying call automatically javascript function passing parameters inside < div > element when page loaded.
know "onload" doesn't work on < div > elements. don't have idea how that.
note..: parameters dynamics because it's inside foreach loop. each loop have 2 different parameters send function.
@foreach(var in something) { <div onload="myfunction(i.param1, i.param2);"> </div> }
you can use script block @ end of <div>
:
<div> ... <script type="text/javascript"> myfunction(dynam_param1, dynam_param2); </script> </div>
Comments
Post a Comment