you're attaching a jquery event to an element that when the script is 
executed is not yet present (it's loading...)

try to rewrite your 

<script type="text/javascript">
  jQuery('#mp_257').click(function(){
    jQuery('#test').html('Test')
    //alert("Test")
  })
</script>

to 

<script type="text/javascript">
  jQuery(document).on('click', '#mp_257', function(){
    jQuery('#test').html('Test')
    //alert("Test")
  })
</script>



On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:
>
> I have a component am loading in a <div>
> <div id="test"></div>
> {{=A('Link to comp', component=URL('research', 'mycomponent.load'), 
> target='setting-content')}}
>
> <div class="span8" id="setting-content">
>
>  </div>
>
> in this same view page i have a <javascript>
>
> <script type="text/javascript">
>   jQuery('#mp_257').click(function(){
>     jQuery('#test').html('Test')
>     //alert("Test")
>   })
> </script>
>
> The component has a button with an id=mp_257, but when i click on it, 
> jQuery in the view above is not being executed by replacing the "Text" in 
> the div...the component has a grid with a custom button created as follows:
>
> links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', _id 
> = 'mp_257', _class='btn')]
>
> Anything why this is not working? But when I put the button in the view 
> using:
>
> {{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id = 'mp_257', 
> _class='btn')}}
>
> All works fine, is there something about loaded component that prevents 
> running of javascript in the same page?
>
> -- 
>
> .......................................................................................
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to