<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic call javascript funciton in anchor click in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105711#M70404</link>
    <description>&lt;P&gt;i added this function into app.js&lt;/P&gt;

&lt;P&gt;function showID(productID)&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;alert(productID);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;how to call from anchor?&lt;/P&gt;

&lt;P&gt;this is not working:&lt;/P&gt;

&lt;P&gt;&amp;lt;a href="javascript:showID(1);"&amp;gt;open product 1&amp;lt;/a&amp;gt;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Dec 2015 14:12:01 GMT</pubDate>
    <dc:creator>fabrizio_d_</dc:creator>
    <dc:date>2015-12-11T14:12:01Z</dc:date>
    <item>
      <title>call javascript funciton in anchor click</title>
      <link>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105711#M70404</link>
      <description>&lt;P&gt;i added this function into app.js&lt;/P&gt;

&lt;P&gt;function showID(productID)&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;alert(productID);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;how to call from anchor?&lt;/P&gt;

&lt;P&gt;this is not working:&lt;/P&gt;

&lt;P&gt;&amp;lt;a href="javascript:showID(1);"&amp;gt;open product 1&amp;lt;/a&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:12:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105711#M70404</guid>
      <dc:creator>fabrizio_d_</dc:creator>
      <dc:date>2015-12-11T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Are you writing this from</title>
      <link>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105712#M70405</link>
      <description>&lt;P&gt;Are you writing this from scratch or using the Design tool? If you are using the Design tool, then the Interactivity pane will help you set up scripts on elements.&lt;/P&gt;

&lt;P&gt;Many developers prefer to keep the content and any interactive logic separate. &amp;nbsp;So instead do this:&lt;/P&gt;

&lt;PRE class="brush:xml;"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;!-- let's use jQuery. Makes this a little easier --&amp;gt;
&amp;lt;script src="jquery.js"&amp;gt;&amp;lt;/script&amp;gt;  
&amp;lt;script&amp;gt;
   function showID(productID)
   {
    console.log("product id:", productID); // I prefer console.log to alert. 
    alert(productID);
   }
   $(document).ready(function()
    {
      $("#my-link").click(function(){ showID(1); return false; })
    })
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;a href="#" id="my-link"&amp;gt;Click Me&amp;lt;/a&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If you haven't used jQuery, you can read more here:&amp;nbsp;https://learn.jquery.com/about-jquery/how-jquery-works/&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I don't necessarily recommend jQuery for all projects, but in this case I think it'll help make things a lot easier. Especially if you are newer to web development.&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 17:06:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105712#M70405</guid>
      <dc:creator>Chris_P_Intel</dc:creator>
      <dc:date>2015-12-11T17:06:57Z</dc:date>
    </item>
    <item>
      <title>in the page are many links,</title>
      <link>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105713#M70406</link>
      <description>&lt;P&gt;in the page are many links, each link is generated from a webservice e represents a product. Clicking on it the app navigates into detail page so need to pass the ProductId to showID function. How to pass the product id using jquery ?&lt;/P&gt;

&lt;P&gt;Anyway this code is working fine:&lt;/P&gt;

&lt;P&gt;&amp;lt;a href="javascript:void(0);" onclick="&lt;CODE class="plain"&gt;showID&lt;/CODE&gt;(1);"&amp;gt;some product&amp;lt;/a&amp;gt;&lt;/P&gt;

&lt;P&gt;&amp;lt;a href="javascript:void(0);" onclick="&lt;CODE class="plain"&gt;showID&lt;/CODE&gt;(2);"&amp;gt;another product&amp;lt;/a&amp;gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 10:16:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/call-javascript-funciton-in-anchor-click/m-p/1105713#M70406</guid>
      <dc:creator>fabrizio_d_</dc:creator>
      <dc:date>2015-12-14T10:16:24Z</dc:date>
    </item>
  </channel>
</rss>

