Jump to content

Recommended Posts

Posted

Hi again,

 

i wanted to ask..is it possible to embed js code in blesta module function?

 

I tried to include javascript code using setHtml function but somehow it is not being called.

 

Can you provide me some hints as to how i can achieve this?

Posted

Hi again,

 

i wanted to ask..is it possible to embed js code in blesta module function?

 

I tried to include javascript code using setHtml function but somehow it is not being called.

 

Can you provide me some hints as to how i can achieve this?

 

there are some module have a sample like cpanel .

 

can you post your sethtml() ?

Posted

$fields->setHtml("
                <script type = \"text/javascript\" src = \"/path-to-js/jquery.min.js\"></script>
                <script type = \"text/javascript\">
                    $(window).load(function(){
                        $(\"#selectId\").prepend(\"<option value=''>__Select option__</option>\").val(' ');
                    });
                    </script>        
        ");

 

I am trying to append an option in the dropdown list using prepend function.

 

Let me know if there's something wrong

Posted

I apologize for a foolish question but do i have to include the jquery file in "/app/view/admin/default/javascript/" when i embed js in module or does it parse automatically??

 

That js src path was just for example.

Posted

the code you have pas should be like this :

$fields->setHtml("
                <script type = 'text/javascript' src = '/path-to-js/jquery.min.js'></script>
                <script type = 'text/javascript'>
                    $(window).load(function(){
                        $('#selectId').prepend(\"<option value=''>__Select option__</option>\").val();
                    });
                    </script>       
        ");

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...