Jump to content
php.lv forumi

Recommended Posts

Posted

Palīdziet lūdzu nounifice't sekojošu koda fragmentu tā lai, lietojot vienu dialoga formu, varētu iedarboties uz dažādiem elementiem

$( "#b_..." ) būs vairāki , attiecīgi katram vajadzētu apendot attiecīgu ...

kkā vajadzētu padot mainīgo uz dialogu?

vai arī ir kādas citas idejas?

 

$( "#b_competition" )
  .button()
  .click(function() {
$( "#dialog-form" ).dialog( "open" );
 });

$( "#dialog-form" ).dialog({
autoOpen: false,
height: 120,
width: 200,
modal: true,
buttons: {
	"Pievienot": function() {
  	$( "#competition" ).append( "<option selected='selected' value='" + $( "#new_option" ).val() + "'>" + $( "#new_option" ).val() + "</option>" );
  	$( this ).dialog( "close" );

	},

Posted (edited)

id būs dažādi un izmantošu slice lai atšķirtu izsaucēja id no apstrādājamā id

var currentId = $(this).attr('id').slice(2);

 

galvenais jau ka nav skaidrs kā padot klasi/id uz izsaukto dialogu!!

Edited by aika
Posted

> Lai iterētu caur objektiem, izmanto $.each

 

Izmanto $.each() tikai tad, kad ir labs iemesls izmantot to, nevis for ().

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...