עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

איך מבצעים שיכפול שדות ב Java script בצורה נכונה

Featured Replies

פורסם

שלום,

רציתי לשאול כיצד אני מבצע דבר כזה, אני מעוניין שיהיה לי נניח מנגנון הזנת תארכים, כזה שיש בכל אתר של חברת תעופה סטנדרטית,כך שתבחרו תאריך, בתוך DIV כאשר יש לו ID מסויים, וכאשר אני לוחץ על כפתור "ADD" נניח אז נוסף לי אפשרות נוספת לבחור עוד תאריך וכן עוד ועוד...

יש לי את הקוד הבא שזאת הפונקציה שמשכפלת:


function clone(){
p=document.getElementById('mydiv')
p.setAttribute("id",'mydiv')
pclone = p.cloneNode(true)
document.getElementById("test").appendChild(pclone)
};

וכאן נמצא ה BODY:


<div id='mydiv'>
<input type="button" value="Rem Date" onclick="rem();"/>
<input id="popup_container" type="text" disabled="disabled" /> <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp" onclick="dp_cal.toggle();"></a>
<input type="button" value="ADD Date" onclick="clone();"/>
<br></br>
</div>
<div id="test"></div>

אני מעוניין לתת ID שונה מן הסתם כל פעם שאני משכפל את החלק של MYDIV, כדי לתת אפשרות אחרי זה גם להסיר אותו וגם כמובן כדי שהערכים שאבחר יהיו שונים.

תודה :)

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.