I have many elements with same name:
<input type="text" name="Education[GraduationDate][0]" />
<input type="text" name="Education[GraduationDate][1]" />
<input type="text" name="Education[GraduationDate][2]" />
<input type="text" name="Education[GraduationDate][3]" />
I want jquery give me the index number of selector name, so if I select first one give me number (0), and so on.
I did this with jquery:
var arrayname = $(this).attr('name');
var arrayindex = arrayname.substring(24,25);
arrayindex return me the Index that I want, but I think this is not good way to do that, because maybe You have index with 2 digit number, so the substring not work fine.
Please advice ..
hope this can help you:
...
var name = ($this).attr('name');
var digits = name.match(/\d+/g)
var index = digits.pop() // suppose your name has more than one digit, the last one is what you want(index)
...
I'm currently using the command: $ ember build --watch --output-path=../public/ to build my ember app. Any ways of achieving the same thing but with a livereload? Thank you.
I'm currently using the command: $ ember build --watch --output-path=../public/ to build my ember app. Any ways of achieving the same thing but with a livereload? Thank you.
I receive a base64 pdf from the server which I want to print. I have been trying the following: $.ajax({ type: "POST", url: url, data: blahblahblah, success: function(data) { ...
I receive a base64 pdf from the server which I want to print. I have been trying the following: $.ajax({ type: "POST", url: url, data: blahblahblah, success: function(data) { ...
If I create an Object as follows: window.Something = { X: function() { // statements... } }; What is the best way to access this object without using this? Example: If I call the X ...
If I create an Object as follows: window.Something = { X: function() { // statements... } }; What is the best way to access this object without using this? Example: If I call the X ...
I need pathname (www.my-site.com/this-part/and-this-part/etc/) in JS/jQuery but I need it as string not as object. In other words I need $_SERVER['REQUEST_URI']; in JS/jQuery. I've tried: var ...
I need pathname (www.my-site.com/this-part/and-this-part/etc/) in JS/jQuery but I need it as string not as object. In other words I need $_SERVER['REQUEST_URI']; in JS/jQuery. I've tried: var ...