Friday, 15 February 2013

javascript - Custom data attributes, chopped and embed a -



javascript - Custom data attributes, chopped and embed a <img> -

i have in mysql

<select> <?php echo "<option value=\"\">select person:</option>";?> <?php while ($row=mysqli_fetch_array($result, mysql_assoc)) { echo "<option value='{$row['idvisa']}' data-visanumber='{$row['visanumber']}' data-idnumber='{$row['idnumber']}' data-statusapp='{$row['statusapp']}' data-accntvisaphotopath='{$row['accntvisaphotopath']}' data-passport='{$row['passportpath]}' data-subdate='{$row['subdate']}'>".$row['fname']." ".$row['lname']."</option>"; } ?> </select>

but got chopped. displays "for" when checked it, supposedly "for select" ..

and script:

<script> $(function(){ $('select').change(function(){ var selected = $(this).find('option:selected'); var $parent = $(this).parents("tr"); $parent.find('#visanumber').html(selected.data('visanumber')); $parent.find('#idnumber').html(selected.data('idnumber')); $parent.find('#statusapp').html(selected.data('statusapp')); $parent.find('#accntvisaphotopath').html(selected.data('imageurl').accntvisaphotopath); //for testing $parent.find('#passportpath').html(selected.data('passportpath')); }); }); </script>

my script providing drop downwards dynamically wonder why chopped. , second, how embed tag in custom info attributes?

and l b ... it's 1 week already, please help. have uprooted hair, gone now.. lol

because forgot quotes! generated source code:

<option value=1 data-visanumber=1234567890 data-idnumber=0987654321 data-statusapp=for selection data-accntvisaphotopath= data-passport= data-subdate=2014-09-21 02:13:50>

should

<option value="1" data-visanumber="1234567890" data-idnumber="0987654321" data-statusapp="for selection" data-accntvisaphotopath="" data-passport="" data-subdate="2014-09-21 02:13:50">

javascript php mysql

No comments:

Post a Comment