TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdul Basith
NA
22
8k
Click function is not working
Mar 10 2016 12:19 AM
In my project i'm drawing the design by using jQuery while runtime,
$(
"#chkotherOwnPropY"
).click(
function
() {
var
str =
""
;
str = str +
' <div class="col-md-10 col-md-offset-1 formGropup">'
+
'<div class="col-md-5 labelDiv">'
+
'<div class="eng">'
+
'<label>If Yes Give the details</label>'
+
'</div>'
+
'</div>'
+
'<div class="group col-md-7">'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 2%">'
+
'<div class="group col-md-4 address">'
+
'<label>Property name</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Name of the owner</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Estimated Price (In Lakhs)</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtPropName">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtOwnerName">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtEstPrime">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
' </div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 0%">'
+
'<div class="group col-md-4 address">'
+
'<label>Survey number</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Re survey number</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Area</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtSurvNo">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtRESurvNo">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
' <div class="group col-md-4 address">'
+
'<input type="text" required id="txtArea">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 0%">'
+
'<div class="group col-md-4 address">'
+
' <label>Village</label>'
+
' </div>'
+
' <div class="group col-md-4 address">'
+
' <label>Taluk</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
' <label>District</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtVillage">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtTaluk">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtDistrict">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
' <div class="col-md-10 col-md-offset-1 formGropup">'
+
'<div class="group col-md-2 address">'
+
' <div class="col-md-2 addButton"><span id="AddDetails">+Add</span> </div>'
+
' </div>'
+
'</div>'
' </div>'
;
$(
"#yesDetailsDiv"
).empty();
if
($(
"#yesDetailsDiv"
).is(
':empty'
)) {
$(
'#yesDetailsDiv'
).append(str);
}
});
The above code works fine. An ADD button is introduced to add extra details if the user needs.
I need to display the same design if the user click add button, so i coded for this
$(
"#AddDetails"
).click(
function
() {
var
str4 =
""
;
str4 = str4 +
' <div class="col-md-10 col-md-offset-1 formGropup">'
+
'<div class="col-md-5 labelDiv">'
+
'<div class="eng">'
+
'</div>'
+
'</div>'
+
'<div class="group col-md-7">'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 2%">'
+
'<div class="group col-md-4 address">'
+
'<label>Property name</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Name of the owner</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Estimated Price (In Lakhs)</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtPropName">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtOwnerName">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtEstPrime">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
' </div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 0%">'
+
'<div class="group col-md-4 address">'
+
'<label>Survey number</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Re survey number</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<label>Area</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtSurvNo">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtRESurvNo">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
' <div class="group col-md-4 address">'
+
'<input type="text" required id="txtArea">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin-top: 0%">'
+
'<div class="group col-md-4 address">'
+
' <label>Village</label>'
+
' </div>'
+
' <div class="group col-md-4 address">'
+
' <label>Taluk</label>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
' <label>District</label>'
+
'</div>'
+
'</div>'
+
'<div class="col-md-10 col-md-offset-1 formGropup" style="margin: 3px 0 3px 0">'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtVillage">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtTaluk">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'<div class="group col-md-4 address">'
+
'<input type="text" required id="txtDistrict">'
+
'<span class="highlight"></span>'
+
'<span class="bar"></span>'
+
'</div>'
+
'</div>'
;
$(
"#yesDetailsDiv"
).append(str4);
});
but here the click function is not working. and i have tried
$(
'#AddDetails'
).live(
'click'
,
function
(){
and
(document).on(
'click'
,
'#AddDetails'
,
function
() {
Why click function is not triggering here?
how can i solve this?
Reply
Answers (
5
)
Jquery DataTable Editor is not a function
jquery to loop in row and get column value in array