Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Why I can't used .find() after my ajax insert the HTML?
This is my problem
On line 44 I consoled it, but it returns blank. When I code already the html not the ajax result it's working.
You are looking for the attribute data-id on the p element but it isn't set.
You need to set it...
data-id='+item.id+'
Like you have already done on the buttons
The object will always return blank because you have id'ed the elements correctly
<td><p>'+item.contact_number+'</p></td>
should be
<td><p data-id='+item.id+'>'+item.contact_number+'</p></td>
Updated the fiddle please have a look
http://jsfiddle.net/w2nscncu/4/
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
i'm trying to make a dynamic dependent dropdown selection , so i got this error in the console when i try to ckeck if the function work or not !
I'am using laravel , ajax , jquery in this project
Also , when i delete the script of the dynamic dropdown box , the error stay
Hope that you can help me
thank you
Usually this has to do with location of your
<script src="something"></script>
make sure you don't have same cdn and make your your link goes before script
something like
<link></link>
<script></script>
All the link should go before script sentence
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I don't know how to get "onclick" effect. I mean how to open new site by click menu. Below i attached example. Please tell what can i do.
https://bslthemes.com/ryan/demo/index-new-no-photo.htm
With addEventListener you have an univerdal method to respond on the click event. Instead of <div> you may use <button> or any other element, that's up to you.
<div id="whatever">Click me</div>
<script>
document.querySelector("#whatever").addEventListener("click", function() {
window.location.replace("https://stackoverflow.com/");
});
</script>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I've tried placing some of the HTML tags inside a JavaScript tag but its not working.can anyone explain it.
No. You can't. HTML is not Javascript (obviously). Any raw html inside a <script> block is simply a syntax error:
<script>
<div>Hi mom!</div> // <-- javascript syntax error
var foo = '<div>Hi mom!</div>'; // valid javascript.
</script>
The second one works because it's NOT Html. It's a javascript string that contains some characters that LOOK like html.
The only HTML-ism that's valid inside javascript is the comment opener, <!--, which is supported only for historical reasons (to hide JS from browsers which didn't understand/support the <script> tag).
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have this:
<div id="something">
content
</div>
And I need change something to somethingnew by using jQuery, so:
<div id="somethingnew">
content
</div>
How can I do it? I've tried function attr, but it doesn't work.
Thanks for advices.
This this:
$("#something").attr("id", "somethingnew");
Try this.
$("#something").attr("id","somethingnew");
$("#something").attr("id", "somethingnew"); should work just fine
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have a page (Facebook page) that has its content changing dynamically. I am writing a GM script but it only loads when the page refreshes, and this is not the case. I have tried to do something like:
mydiv.addEventListener('load', myfunc() ,false );
as I saw in a different thread, but it didn't work. What am I doing wrong?
Thanks.
Use setInterval() or the waitForKeyElements utility.
Can't give any more detail unless you provide specifics like: what, exactly, you are trying to do; before-and-after HTML; or even a link to the page and/or screenshots.
Change myfunc() to myfunc.
Using myfunc(), you are calling the function.
While myfunc is just passing the reference to your function.