jquery - Trouble getting value from form element -


i'm building visually appealing version of option-select element.

i'm making ul have .selected class applied whatever item clicked.

            <ul id="videolist" class="tilelist">                  <li id="video-'. $video-id .'">                         <img src="assetspath/etc/'. $video-thumb .'" />                         <h4>'. $video-title .'</h4>                         <p class="hidden vid-id">'. $video-id .'</p>                     </li>                 ';} ?>             </ul>              <input id="videoid" class="hidden" value="<?php echo $current->video ?>" /> 

and jquery:

$(function(){      $('#videolist li').click( function() {          $('#videolist li').removeclass('selected');         $(this).addclass('selected');          var vidid = $(this).find('.vid-id').val();         alert (vidid);         $('#videoid').val( vidid );     });  });  

the issue $(this).find('.vid-id').val(); doesn't seem returning anything. don't see wrong selector bit new jquery.

what looking text() not val() if meaning pull p tag.

if want pull input you're going have select id this: $(this).find('#videoid').val();

also, don't need add css properties hide input, can type="hidden"


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -