How do I find Prod Title Id

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
khalidhabib.cs
Forum Newbie
Posts: 14
Joined: Tue Jul 17, 2012 1:35 am

How do I find Prod Title Id

Post by khalidhabib.cs »

here is my Code I want Create a function which take element id dynamically

function otherCatChargs(qty,prodTitle){


var quantity=document.getElementById(qty).value;
var proTitle=document.getElementById(prodTitle).innerHTML;
var service_charges=175;
var concert_tckt_service=150;

and here is code where i calling it

<td class="product-title" id="product-title<?php echo $counter;?>"><?php echo $d[$i];?></td><input type="hidden" name="p_name<?php echo $counter;?>" id="prd_name" value="<?php echo $d[$i];?>" />
<input type="hidden" name="item_id<?php echo $counter;?>" value="<?php echo $row['item_id'];?>"/>
<td class="num-pallets"><input type="text" class="num-pallets-input" name="product_qty<?php echo $counter; ?>" id="turface-mvp-num-pallets<?php echo $counter; ?>" onkeyup="otherCatChargs(this.id)"/></td>

How I find It of product-title class ..
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: How do I find Prod Title Id

Post by social_experiment »

You could use getElementsByClassName() but it's not supported by IE8 and earlier; take a look at this url, might be helpful.
http://robertnyman.com/2005/11/07/the-u ... classname/
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
khalidhabib.cs
Forum Newbie
Posts: 14
Joined: Tue Jul 17, 2012 1:35 am

Re: How do I find Prod Title Id

Post by khalidhabib.cs »

Thank You Boss :*
Post Reply