简体   繁体   中英

a href onclick not working in windows phone cordova app

I have used winstore-jscompat.js for js fix. below code generate sub categories. But it doesnt call parseSubCategory function.

            $.each(category.sub_categories, function(index2, subcategory) {
                   var subCatName = subcategory.name;
                   $("#test-listview" + index).append('<li><a onclick=\"parseSubCategory(' + subcategory.id + ',\'' + subCatName + '\');\" href="#product_List">' + subcategory.name + '</a></li>');

             });

Edit:

This is working fine on ios and android but not in windows mobile phone

Issue happened because of pulling in potentially unsafe content from an external sources. We can modify jquery source and ignore this. I have found the solutions here.

https://www.incloud.de/2012/08/windows-8-using-jquery-for-app-development/

It works for me.

Customize the content security policy in the meta tag:

http-equiv="Content-Security-Policy"

As needed. Add unsafe-inline to default-src to enable inline JavaScript.

For details, see http://go.microsoft.com/fwlink/?LinkID=617521

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM