[英]How to get id from a href link during popup
I wish to get 'id' value from href tag. 我希望从href标签获得“ id”值。
When i click the tag the popup will shown , but i want id value within popup 当我单击标签时,将显示弹出窗口,但我希望ID值在弹出窗口中
HTML 的HTML
<a href="#myPopup" data-rel="popup" id="<?php echo $rows['vid'];?>" class="p-buy ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">View Now</a></div>
i want this 'id' value in popup it will come like id='1' ,id='2',.. 我希望在弹出窗口中显示此“ id”值,就像id ='1',id ='2'..
'id' value shown properly in inspect area. “ id”值在检查区域中正确显示。 But i am not getting this value to my popup
但我没有在弹出窗口中获得此值
POPUP HTML 弹出HTML
<div data-role="popup" id="myPopup" class="ui-content" style="min-width:250px;">
<form method="post" action="">
<div>
<h3>Please fill below information</h3>
<label for="usrnm" class="ui-hidden-accessible">Name:</label>
<input type="text" name="name" id="name" placeholder="Name">
<input type="text" name="vids" id="vids" placeholder="video id">
<label for="usrnm" class="ui-hidden-accessible">Email Id:</label>
<input type="text" name="email" id="email" placeholder="Email">
<label for="pswd" class="ui-hidden-accessible">Mobile:</label>
<input type="text" name="mobile" id="mobile" placeholder="Mobile">
<input type="submit" name="submit" id="submit" data-inline="true" value="Submit">
</div>
</form>
</div>
Then i use JQuery for to get the ID. 然后,我使用JQuery来获取ID。 But when i click the tag it does not go to ready function also
但是当我单击标签时,它也不会进入就绪功能
JQUERY JQUERY
$(document).ready(function()
{
alert("ready");
$("a").click(function()
{
alert("click");
var pos = $(this).attr('id');
alert(pos);
$('#vids').val(pos);
});
});
Please help me anyone i stucked long time with this. 请帮助我长期坚持的任何人。
Thanks in advance 提前谢谢
If you want to retrieve id in variable you can use document.getElementByTagName('href') and store into variable x. 如果要检索变量中的ID,可以使用document.getElementByTagName('href')并将其存储到变量x中。 Then document.write(x.id) should write id of href.
然后document.write(x.id)应该写href的ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.