0
   

Javascript Help

 
 
Reply Thu 10 Jan, 2013 01:12 am
Hello, i am writing some javascript for a website and have stumbled across a problem.

I have this section of code:

Javascript File:

.bind('drop', function (evt) {
var id = evt.dataTransfer.getData('text'),
item = $('#' + id),
cartList = $("#cart ul"),
total = $("#total span"),
price = $('p:eq(1) span', item).text(),
prevCartItem = null,
notInCart = (function () {
var lis = $('li', cartList),
len = lis.length,
i;

PHP Page:
echo " <input type=\"radio\" name=\"credit_used\" value=\"currency1\" onclick=\"set_credit();\" >currency1<br>";
echo " <input type=\"radio\" name=\"credit_used\" value=\"currency2\" onclick=\"set_credit();\">currency2";

I want to make it so that when a user clicks on currency 1, this line:
price = $('p:eq(1) span', item).text(),
stays as it is, but if they select currency 2. the line becomes
price = $('p:eq(2) span', item).text(),

How would i go about this? i have tryed using a function and also if/else statements.
Many thanks
Ryan
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,002 • Replies: 1
No top replies

 
DuncanJones
 
  0  
Reply Wed 23 Jan, 2013 04:15 am
Hello all,

Thanks for your great posting this is really nice. I have used your java script coding.
Very appreciated one so please keep posting like this.

Thanks a lot
Duncan Jones
0 Replies
 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » Javascript Help
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 05/10/2024 at 08:09:03