JB.
JB.

Reputation: 913

Javascript change value inside class

I am using a video carousel to browse through videos and would like the current video to auto play.

All the videos are defaulted to "autoplay=false". What I am looking for is; if the class="current" then "autoplay=true"

  <li class="NOT-current">
    <object data="http://view.vzaar.com/12345" type="application/x-shockwave-flash">
      <param value="showplaybutton=rollover&amp;border=none&amp;autoplay=flase" />
    </object>
  </li>

  <li class="current">
    <object data="http://view.vzaar.com/12345" type="application/x-shockwave-flash">
      <param value="showplaybutton=rollover&amp;border=none&amp;autoplay=TRUE" />
    </object>
  </li>

  <li class="NOT-current">
    <object data="http://view.vzaar.com/12345" type="application/x-shockwave-flash">
      <param value="showplaybutton=rollover&amp;border=none&amp;autoplay=false" />
    </object>
  </li>

I know there must be a very simple line of js to change this, maybe using find and replace, but I cant figure it out

Upvotes: 1

Views: 476

Answers (3)

huysentruitw
huysentruitw

Reputation: 28131

If you're using jQuery, you could try this:

$("li.current object").context.play();

Upvotes: 0

Sandeep Manne
Sandeep Manne

Reputation: 6092

There must be some javascript you are using to change the class to current video object there only add a line $(videoObject).play(); to play the video

Upvotes: 0

Aleks
Aleks

Reputation: 410

I don't know about pure js, but you could try something like that with jQuery :

var object = $(".current").find("object");
object.children().attr("value", "showplaybutton=rollover&amp;border=none&amp;autoplay=TRUE");

Upvotes: 2

Related Questions