76
rated 0 times
[
82]
[
6]
/ answers: 1 / hits: 36546
/ 10 Years ago, wed, july 16, 2014, 12:00:00
Iam printing some content using php code inside html but, when i tried to click on that div its not calling the function in onClick ??
Here is my php code
echo '<div class=col-sm-12 col-xs-12 ><div class=row >';
echo '<div class=col-sm-10 onClick=openUrlInNewTab('.$myarray['Job']['link'].');><h3>';
echo $myarray['Job']['title'].</h3></div></div></div>;
this is resulting html code in view source of browser
<div class=col-sm-12 col-xs-12 >
<div class=row >
<div class=col-sm-10 onClick=openUrlInNewTab(www.example.com); >
<h3>Can you Code? </h3>
</div>
</div>
</div>
and here is my function in html page
function openUrlInNewTab(url) {
// div click is not reaching here
alert(url);
window.open(url, _blank);
}
More From » php