Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jQuery: Setting parameters dynamically
Old 06-20-2011, 08:50 AM jQuery: Setting parameters dynamically
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
I've probably worded the title of this completely wrong, but it's the most suitable one I can think of!

Here is the code I'm working with (for jPlayer plugin):

Code:
$(document).ready(function(){
    $('.jp-jplayer').jPlayer({
        ready: function () {
            $(this).jPlayer('setMedia', {
                m4v: 'www.someurl.com/video.m4v'
            });
        },
        ended: function (event) {
            $(this).jPlayer('play');
        }
    });
});
What I'm trying to do is modify the code so that instead of m4v: 'www.someurl.com/video.m4v' it uses the value of the following:
Code:
$(this).next('input').val()
I can output this value in an alert statement no problem, but problems arise if I change my loop like so:
Code:
$(this).jPlayer('setMedia', {
                m4v: $(this).next('input').val()
            });
Does anyone know how I can modify my script so that it gets the urls from hidden input tags? On my page I have several '.jp-jplayer' elements and inside each one is an element similar to the following:
Code:
<input type="hidden" value="www.someurl.com/video.m4v" />
If anyone could help me out that would be great!
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 06-20-2011, 04:50 PM Re: jQuery: Setting parameters dynamically
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I don't think you can have an expression to be valuated in your json construct. Try to just store the value in a temporary variable, like so:

Code:
$(document).ready(function(){
    $('.jp-jplayer').jPlayer({
        ready: function () {
            var hidden = $(this).next('input').val();
            $(this).jPlayer('setMedia', {
                m4v: hidden
            });
        },
        ended: function (event) {
            $(this).jPlayer('play');
        }
    });
});
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 07-08-2011, 09:04 AM Re: jQuery: Setting parameters dynamically
Experienced Talker

Posts: 35
Trades: 0
Hi,

All you must do is you must search for event and how it is hadled in the function jPlayer ()and what are all the events that comes with function if you are familiar with the function called u can handle any kind of problem because key role is played by this function
__________________
Magento Themes Experts

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
shankar.adodis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to jQuery: Setting parameters dynamically
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.53802 seconds with 12 queries