jquery - Call a function on href -


below script

 $('<a class="page_link" href="javascript:'+getresults('http://192.168.1.122:10039/wps/mycontenthandler/vamshi/!ut/p/digest!sqacniaqyulfhaustkggjq/searchfeed/search?query=*&scope=1440172377201&start=0&results=1000&pagesize=2&page=' + i)+'" longdesc="0" style="display: inline-block;">' + + '</a>').insertbefore('.next_link');  

like above trying call function on href attribute. is showing undefined on href.

what proper way of doing this?

i recommend create html using jquery , bind event using it. refer jquery( html, attributes )

$('<a />', {     'class' : 'page_link',      'longdesc' : 0,     'text' :   }).css({     'display' : 'inline-block' }).on('click', function(){     getresults('http://192.168.1.122:10039/wps/mycontenthandler/vamshi/!ut/p/digest!sqacniaqyulfhaustkggjq/searchfeed/search?query=*&scope=1440172377201&start=0&results=1000&pagesize=2&page=' + $(this).text()); }) .insertbefore('.next_link');  

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -